Skip to content

Commit efe693e

Browse files
committed
refactor(eslint)
1 parent a186abd commit efe693e

File tree

61 files changed

+1733
-186
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+1733
-186
lines changed

.github/scripts/generateIndexFile.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const prettierConfig = JSON.parse(readFileSync('.prettierrc').toString('utf-8'))
2828
async function generateBaseIndex() {
2929
const lines: string[] = [
3030
'/* v8 ignore next 1000 */',
31-
'/* eslint-disable max-len */',
31+
'/* eslint-disable @stylistic/max-len */',
3232
'',
3333
'',
3434
"import Client from './Client.js';",

eslint.config.js

Lines changed: 66 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,95 @@
1+
/* eslint-disable */
12
import globals from 'globals';
23
import prettier from 'eslint-config-prettier';
34
import sortImports from '@j4cobi/eslint-plugin-sort-imports';
45
import ts from 'typescript-eslint';
6+
import stylistic from '@stylistic/eslint-plugin';
7+
import { globalIgnores } from 'eslint/config';
58

69
export default [
710
...ts.configs.recommended,
811
prettier,
12+
globalIgnores(['./dist/', './coverage/', './documentation/']),
913
{
10-
ignores: ['**/node_modules/', '**/build/', '**/pnpm-lock.yaml'],
14+
files: ['**/*.ts', '**/*.js'],
1115
languageOptions: { ecmaVersion: 2022, sourceType: 'module', globals: { ...globals.es2022, ...globals.node } },
12-
plugins: { 'sort-imports': sortImports },
16+
plugins: { '@stylistic': stylistic, 'sort-imports': sortImports },
1317
rules: {
1418
'sort-imports/sort-imports': [
1519
'error',
1620
{ ignoreCase: false, ignoreMemberSort: false, memberSyntaxSortOrder: ['all', 'single', 'multiple', 'none'] }
1721
],
18-
'max-len': ['error', { code: 120, ignoreUrls: true, ignoreComments: true }],
22+
'@stylistic/max-len': [
23+
'error',
24+
{ code: 120, tabWidth: 2, ignoreComments: true, ignoreUrls: true, ignoreRegExpLiterals: true }
25+
],
26+
'@stylistic/space-before-function-paren': ['error', { anonymous: 'never', named: 'never', catch: 'always' }],
27+
'@stylistic/function-call-argument-newline': ['error', 'consistent'],
1928
'@typescript-eslint/no-unused-vars': ['error', { args: 'none' }],
29+
'@stylistic/quotes': ['error', 'single', { avoidEscape: true }],
30+
'@stylistic/array-bracket-newline': ['error', 'consistent'],
31+
'@stylistic/array-element-newline': ['warn', 'consistent'],
2032
'no-constant-condition': ['error', { checkLoops: false }],
33+
'no-extend-native': ['warn', { exceptions: ['Object'] }],
34+
'@stylistic/nonblock-statement-body-position': 'error',
35+
'@stylistic/object-curly-spacing': ['error', 'always'],
36+
'@stylistic/no-whitespace-before-property': 'error',
37+
'@stylistic/one-var-declaration-per-line': 'error',
2138
'prefer-const': ['warn', { destructuring: 'all' }],
39+
'@stylistic/dot-location': ['error', 'property'],
40+
'@stylistic/computed-property-spacing': 'error',
41+
'@stylistic/no-mixed-spaces-and-tabs': 'error',
42+
'@stylistic/type-named-tuple-spacing': 'error',
2243
curly: ['warn', 'multi-line', 'consistent'],
44+
'@stylistic/no-multiple-empty-lines': 'error',
45+
'@stylistic/max-statements-per-line': 'error',
46+
'@stylistic/type-annotation-spacing': 'error',
47+
'@stylistic/member-delimiter-style': 'error',
48+
'@stylistic/template-curly-spacing': 'error',
2349
'@typescript-eslint/no-explicit-any': 'off',
50+
'@stylistic/line-comment-position': 'error',
51+
'@stylistic/object-curly-newline': 'error',
52+
'@stylistic/array-bracket-spacing': 'warn',
53+
'@stylistic/switch-colon-spacing': 'error',
54+
'@stylistic/type-generic-spacing': 'error',
55+
'@stylistic/rest-spread-spacing': 'error',
56+
'@stylistic/no-floating-decimal': 'error',
57+
'@stylistic/space-before-blocks': 'error',
58+
'@stylistic/no-trailing-spaces': 'error',
59+
'@stylistic/no-confusing-arrow': 'error',
2460
'logical-assignment-operators': 'warn',
2561
'no-template-curly-in-string': 'error',
62+
'@stylistic/space-in-parens': 'error',
63+
'@stylistic/space-infix-ops': 'error',
64+
'@stylistic/no-multi-spaces': 'error',
65+
'@stylistic/keyword-spacing': 'error',
66+
'@stylistic/linebreak-style': 'error',
2667
'quote-props': ['error', 'as-needed'],
27-
'comma-dangle': ['error', 'never'],
68+
'@stylistic/spaced-comment': 'error',
69+
'@stylistic/no-extra-semi': 'error',
70+
'@stylistic/arrow-spacing': 'error',
71+
'@stylistic/block-spacing': 'error',
72+
'@stylistic/comma-spacing': 'error',
73+
'@stylistic/curly-newline': 'error',
74+
'@stylistic/semi-spacing': 'error',
75+
'@stylistic/arrow-parens': 'error',
76+
'@stylistic/comma-dangle': 'error',
77+
'@stylistic/brace-style': 'error',
78+
'@stylistic/indent': ['error', 2],
79+
'@stylistic/key-spacing': 'error',
80+
'@stylistic/comma-style': 'error',
2881
'no-useless-constructor': 'error',
82+
'@stylistic/semi-style': 'error',
83+
'@stylistic/wrap-regex': 'error',
84+
'@stylistic/new-parens': 'error',
2985
'no-useless-assignment': 'error',
3086
'no-inner-declarations': 'error',
3187
'no-implicit-coercion': 'error',
88+
'@stylistic/eol-last': 'error',
3289
'no-use-before-define': 'warn',
3390
'no-underscore-dangle': 'warn',
3491
'no-unneeded-ternary': 'error',
92+
'@stylistic/no-tabs': 'error',
3593
'default-param-last': 'error',
3694
'one-var': ['warn', 'never'],
3795
'no-inline-comments': 'warn',
@@ -40,27 +98,25 @@ export default [
4098
'no-useless-rename': 'warn',
4199
'no-useless-concat': 'warn',
42100
'no-throw-literal': 'error',
43-
'no-extend-native': 'error',
44101
'default-case-last': 'warn',
102+
'@stylistic/semi': 'error',
45103
'no-self-compare': 'error',
46104
'no-new-wrappers': 'error',
105+
yoda: ['error', 'never'],
106+
'@stylistic/semi': 'error',
47107
'no-lone-blocks': 'error',
48108
'no-undef-init': 'error',
49109
'no-else-return': 'warn',
50-
'no-extra-semi': 'error',
51110
'require-await': 'warn',
52-
yoda: ['error', 'always'],
53111
'default-case': 'error',
54112
'dot-notation': 'error',
55113
'no-sequences': 'warn',
56114
'no-multi-str': 'warn',
57115
'no-lonely-if': 'warn',
58116
'no-new-func': 'error',
59-
'no-console': 'error',
60117
camelcase: 'warn',
61118
'no-var': 'warn',
62-
eqeqeq: 'warn',
63-
semi: 'error'
119+
eqeqeq: 'warn'
64120
}
65121
}
66122
];

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
"@8hobbies/typedoc-plugin-404": "^3.2.1",
5353
"@eslint/js": "^9.35.0",
5454
"@j4cobi/eslint-plugin-sort-imports": "^1.0.2",
55+
"@stylistic/eslint-plugin": "^5.3.1",
5556
"@types/eslint": "^9.6.1",
5657
"@types/node": "^22.18.3",
5758
"@types/xml2js": "^0.4.14",
@@ -60,6 +61,7 @@
6061
"dotenv": "^16.6.1",
6162
"eslint": "^9.35.0",
6263
"eslint-config-prettier": "^10.1.8",
64+
"eslint-plugin-import": "^2.32.0",
6365
"globals": "^16.4.0",
6466
"prettier": "^3.6.2",
6567
"typedoc": "^0.27.9",

0 commit comments

Comments
 (0)