Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

79 changes: 0 additions & 79 deletions .eslintrc.base.json

This file was deleted.

18 changes: 0 additions & 18 deletions .eslintrc.json

This file was deleted.

2 changes: 0 additions & 2 deletions client-node-tests/.eslintignore

This file was deleted.

8 changes: 0 additions & 8 deletions client-node-tests/.eslintrc.json

This file was deleted.

10 changes: 10 additions & 0 deletions client-node-tests/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// @ts-check
'use strict';

const { createConfig } = require('../eslint.config.base.js');

module.exports = createConfig(
['./src/tsconfig.json'],
undefined,
{}
);
2 changes: 1 addition & 1 deletion client-node-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"clean": "rimraf lib",
"compile": "tsc -b ./tsconfig.json",
"watch": "tsc -b ./tsconfig.watch.json -w",
"lint": "eslint --ext ts src",
"lint": "eslint src",
"test": "node ../build/bin/symlink-tests.js && node lib/runTests.js",
"all": "npm run clean && npm run compile && npm run lint && npm run test",
"symlink:publish": "node ../build/bin/symlink-client-tests-publish.js",
Expand Down
2 changes: 0 additions & 2 deletions client/.eslintignore

This file was deleted.

8 changes: 0 additions & 8 deletions client/.eslintrc.json

This file was deleted.

10 changes: 10 additions & 0 deletions client/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// @ts-check
'use strict';

const { createConfig } = require('../eslint.config.base.js');

module.exports = createConfig(
['src/browser/tsconfig.json', 'src/common/tsconfig.json', 'src/node/tsconfig.json'],
undefined,
{}
);
2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"compile": "tsc -b ./tsconfig.json && shx cp src/node/terminateProcess.sh lib/node/terminateProcess.sh",
"compile:clean": "git clean -xfd . && npm install && npm run clean && npm run compile",
"watch": "tsc -b ./tsconfig.watch.json -w",
"lint": "eslint --ext ts src",
"lint": "eslint src",
"test": "cd ../client-node-tests && npm test && cd ../client",
"clean": "rimraf lib",
"all": "npm run clean && npm run compile && npm run lint && npm test",
Expand Down
79 changes: 79 additions & 0 deletions eslint.config.base.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
// @ts-check
'use strict';

const tseslint = require('typescript-eslint');
const stylistic = require('@stylistic/eslint-plugin');
const globals = require('globals');

/**
* Creates an ESLint flat config array for a TypeScript package.
*
* @param {string[]} projects - tsconfig project paths (relative to the package root)
* @param {string[]} [ignores] - additional paths/globs to ignore
* @param {Record<string, unknown>} [extraRules] - package-specific rule overrides
* @returns {import('eslint').Linter.Config[]}
*/
function createConfig(projects, ignores, extraRules) {
return tseslint.config(
{
ignores: ['lib/**', 'dist/**', 'node_modules/**', ...(ignores ?? [])],
},
{
files: ['**/*.ts'],
extends: [tseslint.configs.base],
languageOptions: {
parserOptions: {
ecmaVersion: 6,
sourceType: 'module',
project: projects,
tsconfigRootDir: process.cwd(),
},
globals: {
...globals.node,
},
},
plugins: {
'@stylistic': stylistic,
},
rules: {
'@stylistic/semi': 'error',
'@stylistic/member-delimiter-style': ['error', {
multiline: { delimiter: 'semi', requireLast: true },
singleline: { delimiter: 'semi', requireLast: false },
multilineDetection: 'brackets',
}],
'@stylistic/indent': ['warn', 'tab', { SwitchCase: 1 }],
'@stylistic/no-extra-semi': 'warn',
'@stylistic/quotes': ['error', 'single', { allowTemplateLiterals: true }],
'@typescript-eslint/no-floating-promises': 'error',
'curly': 'warn',
'eqeqeq': 'error',
'constructor-super': 'warn',
'prefer-const': ['warn', { destructuring: 'all' }],
'no-caller': 'warn',
'no-case-declarations': 'warn',
'no-debugger': 'warn',
'no-duplicate-case': 'warn',
'no-duplicate-imports': 'warn',
'no-eval': 'warn',
'no-async-promise-executor': 'warn',
'no-new-wrappers': 'warn',
'no-redeclare': 'off',
'no-sparse-arrays': 'warn',
'no-throw-literal': 'warn',
'no-unsafe-finally': 'warn',
'no-unused-labels': 'warn',
'no-restricted-globals': ['warn', 'name', 'length', 'event', 'closed', 'external', 'status', 'origin', 'orientation', 'context'],
'no-var': 'warn',
'@typescript-eslint/naming-convention': ['warn', {
selector: 'class',
format: ['PascalCase'],
leadingUnderscore: 'allow',
}],
...extraRules,
},
},
);
}

module.exports = { createConfig };
33 changes: 33 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// @ts-check
'use strict';

const stylistic = require('@stylistic/eslint-plugin');
const globals = require('globals');

/** @type {import('eslint').Linter.Config[]} */
module.exports = [
{
ignores: ['node_modules/**', 'lib/**', '**/.tsconfigrc.js'],
},
{
files: ['**/*.js'],
plugins: {
'@stylistic': stylistic,
},
languageOptions: {
ecmaVersion: 2020,
globals: {
...globals.commonjs,
...globals.es2015,
},
},
rules: {
'@stylistic/semi': 'error',
'@stylistic/no-extra-semi': 'warn',
'curly': 'warn',
'@stylistic/quotes': ['error', 'single', { allowTemplateLiterals: true }],
'eqeqeq': 'error',
'@stylistic/indent': ['warn', 'tab', { SwitchCase: 1 }],
},
},
];
2 changes: 0 additions & 2 deletions jsonrpc/.eslintignore

This file was deleted.

9 changes: 0 additions & 9 deletions jsonrpc/.eslintrc.json

This file was deleted.

12 changes: 12 additions & 0 deletions jsonrpc/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// @ts-check
'use strict';

const { createConfig } = require('../eslint.config.base.js');

module.exports = createConfig(
['src/browser/tsconfig.json', 'src/browser/test/tsconfig.json', 'src/common/tsconfig.json', 'src/common/test/tsconfig.json', 'src/node/tsconfig.json', 'src/node/test/tsconfig.json'],
['dist/**'],
{
'no-console': 'error',
}
);
2 changes: 1 addition & 1 deletion jsonrpc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"compile": "tsc -b ./tsconfig.json",
"watch": "tsc -b ./tsconfig.watch.json -w",
"clean": "rimraf lib && rimraf dist",
"lint": "eslint --ext ts src",
"lint": "eslint src",
"test": "npm run test:node && npm run test:browser",
"test:node": "node ../node_modules/mocha/bin/_mocha",
"test:browser": "npm run webpack:test:silent && node ../build/bin/runBrowserTests.js http://127.0.0.1:8080/jsonrpc/src/browser/test/",
Expand Down
1 change: 0 additions & 1 deletion jsonrpc/src/common/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1566,7 +1566,6 @@ export function createMessageConnection(messageReader: MessageReader, messageWri
messageReader.listen(callback);
},
inspect: (): void => {
// eslint-disable-next-line no-console
RAL().console.log('inspect');
}
};
Expand Down
1 change: 0 additions & 1 deletion jsonrpc/src/common/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ class CallbackList {
try {
ret.push(callbacks[i].apply(contexts[i], args));
} catch (e) {
// eslint-disable-next-line no-console
RAL().console.error(e);
}
}
Expand Down
Loading