Skip to content

Commit 7c87c12

Browse files
committed
Finalizing eslint update
1 parent 7166d69 commit 7c87c12

3 files changed

Lines changed: 1660 additions & 1099 deletions

File tree

eslint.config.js

Lines changed: 9 additions & 199 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,15 @@
33
* [BSD-3-Clause](https://github.com/pryv/lib-js/blob/master/LICENSE)
44
*/
55
/**
6-
* ESLint flat config - replaces semistandard with modern tooling
6+
* ESLint flat config using neostandard (modern successor to semistandard)
77
* Style: StandardJS with semicolons + TypeScript checks
88
*/
9-
const js = require('@eslint/js');
10-
const stylistic = require('@stylistic/eslint-plugin');
9+
const neostandard = require('neostandard');
1110
const tseslint = require('typescript-eslint');
12-
const nodePlugin = require('eslint-plugin-n');
1311
const globals = require('globals');
1412

1513
module.exports = [
16-
// Ignore patterns (replaces semistandard.ignore in package.json)
14+
// Ignore patterns
1715
{
1816
ignores: [
1917
'node_modules/**',
@@ -24,19 +22,15 @@ module.exports = [
2422
]
2523
},
2624

27-
// Base JS recommended rules
28-
js.configs.recommended,
25+
// Neostandard with semicolons (semistandard style)
26+
...neostandard({ semi: true, noStyle: false }),
2927

3028
// TypeScript support
3129
...tseslint.configs.recommended,
3230

33-
// Main configuration for JS/TS files
31+
// Main configuration
3432
{
3533
files: ['**/*.js', '**/*.ts'],
36-
plugins: {
37-
'@stylistic': stylistic,
38-
'n': nodePlugin
39-
},
4034
languageOptions: {
4135
ecmaVersion: 2022,
4236
sourceType: 'commonjs',
@@ -52,198 +46,16 @@ module.exports = [
5246
}
5347
},
5448
rules: {
55-
// ============================================
56-
// Stylistic rules (semistandard style)
57-
// ============================================
58-
59-
// Semicolons: REQUIRED (this is what makes it "semi" standard)
60-
'@stylistic/semi': ['error', 'always'],
61-
'@stylistic/semi-spacing': ['error', { before: false, after: true }],
62-
63-
// Indentation: 2 spaces
64-
'@stylistic/indent': ['error', 2, { SwitchCase: 1 }],
65-
66-
// Quotes: single quotes
67-
'@stylistic/quotes': ['error', 'single', { avoidEscape: true, allowTemplateLiterals: true }],
68-
69-
// Spacing
70-
'@stylistic/space-before-function-paren': ['error', {
71-
anonymous: 'always',
72-
named: 'always',
73-
asyncArrow: 'always'
74-
}],
75-
'@stylistic/space-before-blocks': ['error', 'always'],
76-
'@stylistic/space-in-parens': ['error', 'never'],
77-
'@stylistic/space-infix-ops': 'error',
78-
'@stylistic/space-unary-ops': ['error', { words: true, nonwords: false }],
79-
'@stylistic/keyword-spacing': ['error', { before: true, after: true }],
80-
'@stylistic/key-spacing': ['error', { beforeColon: false, afterColon: true }],
81-
'@stylistic/comma-spacing': ['error', { before: false, after: true }],
82-
'@stylistic/array-bracket-spacing': ['error', 'never'],
83-
'@stylistic/object-curly-spacing': ['error', 'always'],
84-
'@stylistic/block-spacing': ['error', 'always'],
85-
'@stylistic/computed-property-spacing': ['error', 'never'],
86-
'@stylistic/func-call-spacing': ['error', 'never'],
87-
'@stylistic/template-curly-spacing': ['error', 'never'],
88-
'@stylistic/no-whitespace-before-property': 'error',
89-
90-
// Line breaks and formatting
91-
'@stylistic/eol-last': ['error', 'always'],
92-
'@stylistic/no-multiple-empty-lines': ['error', { max: 1, maxEOF: 0 }],
93-
'@stylistic/no-trailing-spaces': 'error',
94-
'@stylistic/linebreak-style': ['error', 'unix'],
95-
'@stylistic/padded-blocks': ['error', 'never'],
96-
97-
// Commas and operators
98-
'@stylistic/comma-dangle': ['error', 'never'],
99-
'@stylistic/comma-style': ['error', 'last'],
100-
'@stylistic/dot-location': ['error', 'property'],
101-
'@stylistic/operator-linebreak': ['error', 'after', { overrides: { '?': 'before', ':': 'before' } }],
102-
103-
// Braces
104-
'@stylistic/brace-style': ['error', '1tbs', { allowSingleLine: true }],
105-
'@stylistic/curly-newline': 'off',
106-
107-
// Other stylistic
108-
'@stylistic/no-mixed-spaces-and-tabs': 'error',
109-
'@stylistic/no-tabs': 'error',
110-
'@stylistic/no-multi-spaces': 'error',
111-
'@stylistic/arrow-spacing': ['error', { before: true, after: true }],
112-
'@stylistic/rest-spread-spacing': ['error', 'never'],
113-
'@stylistic/yield-star-spacing': ['error', 'after'],
114-
'@stylistic/generator-star-spacing': ['error', { before: false, after: true }],
115-
'@stylistic/new-parens': 'error',
116-
'@stylistic/wrap-iife': ['error', 'any'],
117-
'@stylistic/spaced-comment': ['error', 'always', {
118-
line: { markers: ['*package', '!', '/', ',', '='] },
119-
block: { balanced: true, markers: ['*package', '!', ',', ':', '::', 'flow-include'], exceptions: ['*'] }
120-
}],
121-
122-
// ============================================
123-
// Standard JS rules
124-
// ============================================
125-
126-
// Best practices
127-
'accessor-pairs': ['error', { setWithoutGet: true, enforceForClassMembers: true }],
128-
'array-callback-return': ['error', { allowImplicit: false, checkForEach: false }],
129-
'constructor-super': 'error',
130-
'default-case-last': 'error',
131-
'eqeqeq': ['error', 'always', { null: 'ignore' }],
132-
'new-cap': ['error', { newIsCap: true, capIsNew: false, properties: true }],
133-
'no-array-constructor': 'error',
134-
'no-async-promise-executor': 'error',
135-
'no-caller': 'error',
136-
'no-case-declarations': 'error',
137-
'no-class-assign': 'error',
138-
'no-compare-neg-zero': 'error',
139-
'no-cond-assign': 'error',
140-
'no-const-assign': 'error',
141-
'no-constant-condition': ['error', { checkLoops: false }],
142-
'no-control-regex': 'error',
143-
'no-debugger': 'error',
144-
'no-delete-var': 'error',
145-
'no-dupe-args': 'error',
146-
'no-dupe-class-members': 'error',
147-
'no-dupe-keys': 'error',
148-
'no-duplicate-case': 'error',
149-
'no-empty': ['error', { allowEmptyCatch: true }],
150-
'no-empty-character-class': 'error',
151-
'no-empty-pattern': 'error',
152-
'no-eval': 'error',
153-
'no-ex-assign': 'error',
154-
'no-extend-native': 'error',
155-
'no-extra-bind': 'error',
156-
'no-extra-boolean-cast': 'error',
157-
'no-fallthrough': 'error',
158-
'no-func-assign': 'error',
159-
'no-global-assign': 'error',
160-
'no-implied-eval': 'error',
161-
'no-import-assign': 'error',
162-
'no-invalid-regexp': 'error',
163-
'no-irregular-whitespace': 'error',
164-
'no-iterator': 'error',
165-
'no-labels': ['error', { allowLoop: false, allowSwitch: false }],
166-
'no-lone-blocks': 'error',
167-
'no-loss-of-precision': 'error',
168-
'no-misleading-character-class': 'error',
169-
'no-multi-str': 'error',
170-
'no-new': 'error',
171-
'no-new-func': 'error',
172-
'no-new-native-nonconstructor': 'error',
173-
'no-new-wrappers': 'error',
174-
'no-obj-calls': 'error',
175-
'no-object-constructor': 'error',
176-
'no-octal': 'error',
177-
'no-octal-escape': 'error',
178-
'no-proto': 'error',
179-
'no-prototype-builtins': 'error',
180-
'no-redeclare': ['error', { builtinGlobals: false }],
181-
'no-regex-spaces': 'error',
182-
'no-return-assign': ['error', 'except-parens'],
183-
'no-self-assign': ['error', { props: true }],
184-
'no-self-compare': 'error',
185-
'no-sequences': 'error',
186-
'no-shadow-restricted-names': 'error',
187-
'no-sparse-arrays': 'error',
188-
'no-template-curly-in-string': 'error',
189-
'no-this-before-super': 'error',
190-
'no-throw-literal': 'error',
191-
'no-undef': 'error',
192-
'no-undef-init': 'error',
193-
'no-unexpected-multiline': 'error',
194-
'no-unmodified-loop-condition': 'error',
195-
'no-unneeded-ternary': ['error', { defaultAssignment: false }],
196-
'no-unreachable': 'error',
197-
'no-unreachable-loop': 'error',
198-
'no-unsafe-finally': 'error',
199-
'no-unsafe-negation': 'error',
200-
'no-unused-expressions': ['error', { allowShortCircuit: true, allowTernary: true, allowTaggedTemplates: true }],
201-
// Disable base rule in favor of @typescript-eslint version
202-
'no-unused-vars': 'off',
203-
'no-use-before-define': ['error', { functions: false, classes: false, variables: false }],
204-
'no-useless-backreference': 'error',
205-
'no-useless-call': 'error',
206-
'no-useless-catch': 'error',
207-
'no-useless-computed-key': 'error',
208-
'no-useless-constructor': 'error',
209-
'no-useless-escape': 'error',
210-
'no-useless-rename': 'error',
211-
'no-useless-return': 'error',
212-
'no-var': 'warn',
213-
'no-void': 'error',
214-
'no-with': 'error',
215-
'object-shorthand': ['warn', 'properties'],
216-
'one-var': ['error', { initialized: 'never' }],
217-
'prefer-const': ['error', { destructuring: 'all' }],
218-
'prefer-promise-reject-errors': 'error',
219-
'prefer-regex-literals': ['error', { disallowRedundantWrapping: true }],
220-
'symbol-description': 'error',
221-
'unicode-bom': ['error', 'never'],
222-
'use-isnan': ['error', { enforceForSwitchCase: true, enforceForIndexOf: true }],
223-
'valid-typeof': ['error', { requireStringLiterals: true }],
224-
'yoda': ['error', 'never'],
225-
226-
// Node.js specific
227-
'n/handle-callback-err': ['error', '^(err|error)$'],
228-
'n/no-callback-literal': 'error',
229-
'n/no-deprecated-api': 'error',
230-
'n/no-exports-assign': 'error',
231-
'n/no-new-require': 'error',
232-
'n/no-path-concat': 'error',
233-
'n/process-exit-as-throw': 'error',
234-
235-
// ============================================
236-
// TypeScript specific rules
237-
// ============================================
49+
// TypeScript adjustments
23850
'@typescript-eslint/no-unused-vars': ['error', {
23951
args: 'none',
24052
caughtErrors: 'none',
24153
ignoreRestSiblings: true,
24254
varsIgnorePattern: '^_',
24355
argsIgnorePattern: '^_'
24456
}],
245-
'@typescript-eslint/no-require-imports': 'off', // Allow require() in CommonJS
246-
'@typescript-eslint/no-explicit-any': 'off', // Allow any for now (existing codebase)
57+
'@typescript-eslint/no-require-imports': 'off',
58+
'@typescript-eslint/no-explicit-any': 'off',
24759
'@typescript-eslint/explicit-function-return-type': 'off',
24860
'@typescript-eslint/explicit-module-boundary-types': 'off',
24961
'@typescript-eslint/ban-ts-comment': 'off'
@@ -254,15 +66,13 @@ module.exports = [
25466
{
25567
files: ['**/*.d.ts'],
25668
rules: {
257-
// Disable all stylistic rules for .d.ts files
25869
'@stylistic/space-before-function-paren': 'off',
25970
'@stylistic/semi': 'off',
26071
'@stylistic/indent': 'off',
26172
'@stylistic/no-multiple-empty-lines': 'off',
26273
'@stylistic/eol-last': 'off',
26374
'@stylistic/no-multi-spaces': 'off',
26475
'@stylistic/no-trailing-spaces': 'off',
265-
// Disable variable/type checks (types come from imports)
26676
'no-undef': 'off',
26777
'no-unused-vars': 'off',
26878
'@typescript-eslint/no-unused-vars': 'off',

0 commit comments

Comments
 (0)