Skip to content

Commit 867d8d2

Browse files
authored
fix: linting (#2966)
Eslint9 and stylistic mean we can ditch prettier, typscript specific rules, and a can revisit the whole eslint config.
1 parent b7dca34 commit 867d8d2

File tree

17 files changed

+108
-302
lines changed

17 files changed

+108
-302
lines changed

.prettierignore

Lines changed: 0 additions & 7 deletions
This file was deleted.

.prettierrc

Lines changed: 0 additions & 7 deletions
This file was deleted.

eslint.config.mjs

Lines changed: 15 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,28 @@
1-
import nodePlugin from 'eslint-plugin-n'
2-
import mocha from 'eslint-plugin-mocha'
31
import globals from 'globals'
4-
import js from '@eslint/js'
5-
import eslintConfigPrettier from 'eslint-config-prettier'
6-
import eslint from '@eslint/js'
7-
import typescriptEslint from 'typescript-eslint'
2+
import pluginJs from '@eslint/js'
3+
import tseslint from 'typescript-eslint'
4+
import mocha from 'eslint-plugin-mocha'
5+
import stylistic from '@stylistic/eslint-plugin'
86

7+
/** @type {import('eslint').Linter.Config[]} */
98
export default [
109
{
11-
ignores: ['packages/*/node_modules', '**/docs', 'packages/*/dist/*'],
10+
ignores: ['**/dist/', '**/*.js'],
1211
},
13-
js.configs.recommended,
14-
nodePlugin.configs['flat/recommended-script'],
12+
{ languageOptions: { globals: globals.node } },
13+
pluginJs.configs.recommended,
14+
...tseslint.configs.recommended,
1515
mocha.configs['flat'].recommended,
16-
...typescriptEslint.configs.recommended,
17-
eslintConfigPrettier,
16+
stylistic.configs['recommended-flat'],
1817
{
19-
languageOptions: {
20-
globals: {
21-
...globals.node,
22-
...globals.mocha,
23-
assert: false,
24-
makeTestFeature: false,
25-
shouldReject: false,
26-
},
27-
ecmaVersion: 12,
28-
sourceType: 'commonjs',
29-
},
30-
3118
rules: {
32-
'no-extra-semi': 'off',
33-
'@typescript-eslint/no-extra-semi': 'off',
34-
'n/no-process-exit': 'off',
35-
'no-var': 'error',
36-
37-
'n/no-extraneous-import': [
38-
'error',
39-
{
40-
allowModules: ['sinon', 'chai'],
41-
},
42-
],
43-
44-
'n/no-missing-import': 'off',
45-
'n/no-missing-require': 'off',
46-
'n/no-unpublished-import': 'off',
47-
'n/no-unpublished-require': 'off',
48-
'n/no-unsupported-features/es-builtins': 'error',
49-
'n/no-unsupported-features/es-syntax': 'off',
50-
'n/no-unsupported-features/node-builtins': 'error',
51-
'n/hashbang': 'off',
52-
'object-shorthand': 'error',
53-
'prefer-arrow-callback': 'error',
54-
'prefer-const': 'error',
55-
'prefer-template': 'error',
56-
'mocha/no-exclusive-tests': 'error',
57-
'mocha/no-hooks-for-single-case': 'off',
5819
'mocha/no-mocha-arrows': 'off',
59-
'mocha/no-pending-tests': 'error',
6020
'mocha/no-setup-in-describe': 'off',
61-
strict: ['error', 'never'],
62-
'valid-jsdoc': 'off',
63-
'@typescript-eslint/no-var-requires': 'off',
64-
'@typescript-eslint/no-empty-function': 'off',
65-
'@typescript-eslint/no-require-imports': 'off',
21+
'mocha/no-exclusive-tests': 'error',
22+
'@stylistic/arrow-parens': ['error', 'as-needed'],
23+
'@stylistic/brace-style': ['error', '1tbs', { allowSingleLine: true }],
24+
'@stylistic/quotes': ['error', 'single', { avoidEscape: true }],
25+
'object-shorthand': ['error', 'always', { avoidQuotes: true }],
6626
},
6727
},
6828
]

0 commit comments

Comments
 (0)