Skip to content

Commit

Permalink
chore: fix some of the new lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
maribethb committed Dec 17, 2021
1 parent 6efaf28 commit d143928
Show file tree
Hide file tree
Showing 8 changed files with 1,234 additions and 331 deletions.
1,506 changes: 1,190 additions & 316 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"test:ghpages": "gulp testGhPages"
},
"devDependencies": {
"@blockly/eslint-config": "^2.0.0",
"@blockly/eslint-config": "^2.1.5",
"eslint": "^7.15.0",
"gh-pages": "^3.1.0",
"gulp": "^4.0.2",
Expand Down
6 changes: 3 additions & 3 deletions plugins/block-extension-tooltip/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ interface TooltipBlock extends Blockly.BlockSvg {

/**
* Register the Blockly tooltip block extension.
* @param {!TooltipRender} tooltipRender Custom tooltip render function.
* @param {string=} extensionName Optional extension name.
* @return {string} The registered extension name.
* @param tooltipRender Custom tooltip render function.
* @param extensionName Optional extension name.
* @return The registered extension name.
*/
export const registerTooltipExtension = (tooltipRender: TooltipRender,
extensionName = 'custom-tooltip-extension') => {
Expand Down
6 changes: 3 additions & 3 deletions plugins/block-extension-tooltip/test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ Object.keys(Blockly.Blocks).forEach((blockId) => {

/**
* Create a workspace.
* @param {HTMLElement} blocklyDiv The blockly container div.
* @param {!Blockly.BlocklyOptions} options The Blockly options.
* @return {!Blockly.WorkspaceSvg} The created workspace.
* @param blocklyDiv The blockly container div.
* @param options The Blockly options.
* @return The created workspace.
*/
function createWorkspace(blocklyDiv: HTMLElement,
options: Blockly.BlocklyOptions): Blockly.WorkspaceSvg {
Expand Down
5 changes: 3 additions & 2 deletions plugins/dev-scripts/scripts/lint.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
const fs = require('fs');
const path = require('path');
const ESLint = require('eslint').ESLint;
// eslint-disable-next-line no-unused-vars
const LintResult = require('eslint').LintResult;

const appDirectory = fs.realpathSync(process.cwd());
Expand All @@ -41,8 +42,8 @@ const linter = new ESLint({
* Lint this directory.
* @param {string} dir The directory to lint.
* @param {ESLint} linter The linter.
* @return {Promise<LintResult[]|null>} The results, which may be printed with
* an approriate formatter.
* @return {Promise<Array<LintResult>|null>} The results, which may be printed
* with an approriate formatter.
*/
async function lintDir(dir, linter) {
const resolvePath = resolveApp(dir);
Expand Down
4 changes: 2 additions & 2 deletions plugins/dev-tools/src/common_test_helpers.mocha.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ export function runTestSuites(testSuites, createTestCaseCallback) {
/**
* Captures the strings sent to console.warn() when calling a function.
* Copies from core.
* @param {function} innerFunc The function where warnings may called.
* @return {string[]} The warning messages (only the first arguments).
* @param {Function} innerFunc The function where warnings may called.
* @return {Array<string>} The warning messages (only the first arguments).
*/
export function captureWarnings(innerFunc) {
const msgs = [];
Expand Down
7 changes: 7 additions & 0 deletions plugins/dev-tools/src/playground/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ import {addGUIControls} from './options';
import {LocalStorageState} from './state';
import {renderCheckbox, renderCodeTab, renderPlayground} from './ui';

/**
* @typedef {?} dat
*/

/**
* @typedef {?} monaco
*/

/**
* @typedef {function(!HTMLElement,!Blockly.BlocklyOptions):
Expand Down
29 changes: 25 additions & 4 deletions plugins/eslint-config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ module.exports = {
rules: {
// http://eslint.org/docs/rules/
'camelcase': 'warn',
'no-warning-comments': 'warn',
'new-cap': ['error', {'capIsNewExceptionPattern': '^.*Error'}],
'no-invalid-this': 'off',
// valid-jsdoc does not work properly for interface methods.
Expand Down Expand Up @@ -101,11 +100,22 @@ module.exports = {
warnOnUnsupportedTypeScriptVersion: true,
},
plugins: ['@typescript-eslint'],
settings: {
jsdoc: {
mode: 'typescript',
},
},

// If adding a typescript-eslint version of an existing ESLint rule,
// make sure to disable the ESLint rule here.
rules: {

// The types are specified in TS rather than JsDoc.
'jsdoc/no-types': 'warn',
'jsdoc/require-param-type': 'off',
'jsdoc/require-property-type': 'off',
'jsdoc/require-returns-type': 'off',

// Already handled by tsc.
'no-dupe-class-members': 'off',
'no-undef': 'off',
Expand All @@ -116,7 +126,7 @@ module.exports = {
'default': 'array-simple',
},
],
'@typescript-eslint/ban-ts-ignore': 'error',
'@typescript-eslint/ban-ts-comment': 'error',
'@typescript-eslint/ban-types': ['error',
{
'types': {
Expand All @@ -136,15 +146,26 @@ module.exports = {
},
],
'camelcase': 'off',
'@typescript-eslint/camelcase': 'warn',
'@typescript-eslint/naming-convention': ['error',
{
'selector': 'default',
'format': ['camelCase', 'PascalCase'],
},
{
'selector': 'class',
'format': ['PascalCase'],
},
{
// Disallow starting interaces with 'I'
'selector': 'interface',
'format': ['PascalCase'],
'custom': {
'regex': '^I[A-Z]',
'match': false,
},
},
],
'@typescript-eslint/consistent-type-assertions': 'error',
'@typescript-eslint/interface-name-prefix': 'error',
'@typescript-eslint/member-delimiter-style': ['error',
{
'multiline': {
Expand Down

0 comments on commit d143928

Please sign in to comment.