@tinkoff/eslint-config 5.2.0 → 5.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,58 +1,61 @@
1
- module.exports = {
2
- plugins: ['sort-class-members'],
1
+ import sortClassMembersPlugin from 'eslint-plugin-sort-class-members';
3
2
 
4
- rules: {
5
- 'sort-class-members/sort-class-members': [
6
- 'error',
7
- {
8
- order: [
9
- '[static-members]',
10
- '[properties]',
11
- '[conventional-private-properties]',
12
- 'constructor',
13
- '[lifecycle]',
14
- '[handlers]',
15
- '[methods]',
16
- '[conventional-private-methods]',
17
- '[rendering]',
18
- '[everything-else]',
19
- ],
20
- groups: {
21
- 'static-members': [{ static: true }],
22
- handlers: [
23
- { name: '/^on.+$/', type: 'method' },
24
- { name: '/^on.+$/', type: 'property' },
25
- { name: '/^handle.+$/', type: 'method' },
26
- { name: '/^handle.+$/', type: 'property' },
3
+ export default [
4
+ sortClassMembersPlugin.configs['flat/recommended'],
5
+ {
6
+ rules: {
7
+ 'sort-class-members/sort-class-members': [
8
+ 'error',
9
+ {
10
+ order: [
11
+ '[static-members]',
12
+ '[properties]',
13
+ '[conventional-private-properties]',
14
+ 'constructor',
15
+ '[lifecycle]',
16
+ '[handlers]',
17
+ '[methods]',
18
+ '[conventional-private-methods]',
19
+ '[rendering]',
20
+ '[everything-else]',
27
21
  ],
28
- lifecycle: [
29
- 'displayName',
30
- 'propTypes',
31
- 'contextTypes',
32
- 'childContextTypes',
33
- 'defaultProps',
34
- 'getDefaultProps',
35
- 'getInitialState',
36
- 'getChildContext',
37
- 'getDerivedStateFromProps',
38
- 'componentWillMount',
39
- 'UNSAFE_componentWillMount',
40
- 'componentDidMount',
41
- 'componentWillReceiveProps',
42
- 'UNSAFE_componentWillReceiveProps',
43
- 'shouldComponentUpdate',
44
- 'componentWillUpdate',
45
- 'UNSAFE_componentWillUpdate',
46
- 'getSnapshotBeforeUpdate',
47
- 'componentDidUpdate',
48
- 'componentDidCatch',
49
- 'componentWillUnmount',
50
- 'componentDidCatch',
51
- ],
52
- rendering: ['/^render.+$/', 'render'],
22
+ groups: {
23
+ 'static-members': [{ static: true }],
24
+ handlers: [
25
+ { name: '/^on.+$/', type: 'method' },
26
+ { name: '/^on.+$/', type: 'property' },
27
+ { name: '/^handle.+$/', type: 'method' },
28
+ { name: '/^handle.+$/', type: 'property' },
29
+ ],
30
+ lifecycle: [
31
+ 'displayName',
32
+ 'propTypes',
33
+ 'contextTypes',
34
+ 'childContextTypes',
35
+ 'defaultProps',
36
+ 'getDefaultProps',
37
+ 'getInitialState',
38
+ 'getChildContext',
39
+ 'getDerivedStateFromProps',
40
+ 'componentWillMount',
41
+ 'UNSAFE_componentWillMount',
42
+ 'componentDidMount',
43
+ 'componentWillReceiveProps',
44
+ 'UNSAFE_componentWillReceiveProps',
45
+ 'shouldComponentUpdate',
46
+ 'componentWillUpdate',
47
+ 'UNSAFE_componentWillUpdate',
48
+ 'getSnapshotBeforeUpdate',
49
+ 'componentDidUpdate',
50
+ 'componentDidCatch',
51
+ 'componentWillUnmount',
52
+ 'componentDidCatch',
53
+ ],
54
+ rendering: ['/^render.+$/', 'render'],
55
+ },
56
+ accessorPairPositioning: 'getThenSet',
53
57
  },
54
- accessorPairPositioning: 'getThenSet',
55
- },
56
- ],
58
+ ],
59
+ },
57
60
  },
58
- };
61
+ ];
@@ -1,18 +1,16 @@
1
- module.exports = {
2
- overrides: [
3
- {
4
- files: ['*.spec.*', '*.test.*', '*.unit.*', '*/__tests__/*'],
1
+ export default [
2
+ {
3
+ files: ['**/*.spec.*', '**/*.test.*', '**/*.unit.*', '**/__tests__/**/*'],
5
4
 
6
- rules: {
7
- '@typescript-eslint/no-empty-function': 'off',
8
- 'max-statements': 'off',
9
- 'max-classes-per-file': 'off',
10
- 'max-nested-callbacks': ['warn', 10],
11
- 'prefer-promise-reject-errors': 'warn',
12
- 'import/no-unresolved': 'off',
13
- 'import/extensions': 'off',
14
- '@typescript-eslint/no-shadow': 'off',
15
- },
5
+ rules: {
6
+ '@typescript-eslint/no-empty-function': 'off',
7
+ 'max-statements': 'off',
8
+ 'max-classes-per-file': 'off',
9
+ 'max-nested-callbacks': ['warn', 10],
10
+ 'prefer-promise-reject-errors': 'warn',
11
+ 'import/no-unresolved': 'off',
12
+ 'import/extensions': 'off',
13
+ '@typescript-eslint/no-shadow': 'off',
16
14
  },
17
- ],
18
- };
15
+ },
16
+ ];
@@ -1,163 +1,176 @@
1
- module.exports = {
2
- extends: ['plugin:@typescript-eslint/eslint-recommended'],
1
+ import tseslint from 'typescript-eslint';
2
+ import tsParser from '@typescript-eslint/parser';
3
3
 
4
- overrides: [
5
- {
6
- extends: [
7
- 'plugin:@typescript-eslint/recommended',
8
- 'prettier',
9
- 'plugin:import/typescript',
10
- ],
11
-
12
- parser: '@typescript-eslint/parser',
13
-
14
- plugins: ['@typescript-eslint'],
15
-
16
- files: ['*.ts', '*.tsx'],
4
+ export default [
5
+ // Turns off base ESLint rules that TypeScript handles better (applies to TS files)
6
+ {
7
+ files: ['**/*.ts', '**/*.tsx'],
8
+ rules: {
9
+ ...tseslint.configs.eslintRecommended.rules,
10
+ },
11
+ },
12
+ // TypeScript-specific configuration
13
+ {
14
+ files: ['**/*.ts', '**/*.tsx'],
15
+ languageOptions: {
16
+ parser: tsParser,
17
+ parserOptions: {
18
+ sourceType: 'module',
19
+ errorOnUnknownASTType: true,
20
+ warnOnUnsupportedTypeScriptVersion: false,
21
+ ecmaVersion: 6,
22
+ },
23
+ },
24
+ plugins: {
25
+ '@typescript-eslint': tseslint.plugin,
26
+ },
27
+ rules: {
28
+ ...tseslint.configs.recommended.rules,
17
29
 
18
- rules: {
19
- // swears on cases like constructor(public c: C) {}
20
- 'no-useless-constructor': 'off',
21
- '@typescript-eslint/explicit-function-return-type': 'off',
22
- 'no-unused-vars': 'off',
23
- '@typescript-eslint/no-unused-vars': [
24
- 'warn',
25
- {
26
- argsIgnorePattern: '^_',
27
- varsIgnorePattern: '^_',
28
- },
29
- ],
30
- 'class-methods-use-this': 'off',
31
- '@typescript-eslint/member-ordering': [
32
- 'off',
33
- {
34
- default: [
35
- 'public-static-field',
36
- 'protected-static-field',
37
- 'private-static-field',
38
- 'public-static-method',
39
- 'protected-static-method',
40
- 'private-static-method',
41
- 'public-instance-field',
42
- 'protected-instance-field',
43
- 'private-instance-field',
44
- 'constructor',
45
- 'public-instance-method',
46
- 'protected-instance-method',
47
- 'private-instance-method',
48
- ],
49
- },
50
- ],
51
- '@typescript-eslint/no-unsafe-function-type': 'error',
52
- '@typescript-eslint/no-wrapper-object-types': 'error',
53
- '@typescript-eslint/no-restricted-types': [
54
- 'error',
55
- {
56
- types: {
57
- String: { message: 'Use string instead', fixWith: 'string' },
58
- Boolean: { message: 'Use boolean instead', fixWith: 'boolean' },
59
- Number: { message: 'Use number instead', fixWith: 'number' },
60
- Object: {
61
- message: 'Use Record<string, any> instead',
62
- fixWith: 'Record<string, any>',
63
- },
64
- object: {
65
- message: 'Use Record<string, any> instead',
66
- fixWith: 'Record<string, any>',
67
- },
30
+ // swears on cases like constructor(public c: C) {}
31
+ 'no-useless-constructor': 'off',
32
+ '@typescript-eslint/explicit-function-return-type': 'off',
33
+ 'no-unused-vars': 'off',
34
+ '@typescript-eslint/no-unused-vars': [
35
+ 'warn',
36
+ {
37
+ argsIgnorePattern: '^_',
38
+ varsIgnorePattern: '^_',
39
+ },
40
+ ],
41
+ 'class-methods-use-this': 'off',
42
+ '@typescript-eslint/member-ordering': [
43
+ 'off',
44
+ {
45
+ default: [
46
+ 'public-static-field',
47
+ 'protected-static-field',
48
+ 'private-static-field',
49
+ 'public-static-method',
50
+ 'protected-static-method',
51
+ 'private-static-method',
52
+ 'public-instance-field',
53
+ 'protected-instance-field',
54
+ 'private-instance-field',
55
+ 'constructor',
56
+ 'public-instance-method',
57
+ 'protected-instance-method',
58
+ 'private-instance-method',
59
+ ],
60
+ },
61
+ ],
62
+ '@typescript-eslint/no-unsafe-function-type': 'error',
63
+ '@typescript-eslint/no-wrapper-object-types': 'error',
64
+ '@typescript-eslint/no-restricted-types': [
65
+ 'error',
66
+ {
67
+ types: {
68
+ String: { message: 'Use string instead', fixWith: 'string' },
69
+ Boolean: { message: 'Use boolean instead', fixWith: 'boolean' },
70
+ Number: { message: 'Use number instead', fixWith: 'number' },
71
+ Object: {
72
+ message: 'Use Record<string, any> instead',
73
+ fixWith: 'Record<string, any>',
74
+ },
75
+ object: {
76
+ message: 'Use Record<string, any> instead',
77
+ fixWith: 'Record<string, any>',
68
78
  },
69
79
  },
70
- ],
71
- '@typescript-eslint/no-extraneous-class': [
72
- 'error',
73
- {
74
- allowWithDecorator: true,
75
- allowStaticOnly: true,
76
- },
77
- ],
78
- // '@typescript-eslint/no-unnecessary-qualifier': 'error', need ts config
79
- // '@typescript-eslint/restrict-plus-operands': 'error', need ts config
80
- '@typescript-eslint/no-explicit-any': 'off',
81
- camelcase: 'off',
82
- '@typescript-eslint/camelcase': 'off',
83
- '@typescript-eslint/naming-convention': [
84
- 'error',
85
- {
86
- selector: 'default',
87
- format: ['camelCase', 'PascalCase'],
88
- leadingUnderscore: 'allow',
89
- trailingUnderscore: 'allow',
90
- },
91
- {
92
- selector: 'variable',
93
- format: ['camelCase', 'PascalCase', 'UPPER_CASE'],
94
- leadingUnderscore: 'allow',
95
- trailingUnderscore: 'allow',
96
- },
97
- {
98
- selector: 'typeLike',
99
- format: ['PascalCase', 'UPPER_CASE'],
100
- },
101
- {
102
- selector: 'property',
103
- format: ['camelCase', 'PascalCase'],
104
- },
105
- {
106
- selector: [
107
- 'classProperty',
108
- 'objectLiteralProperty',
109
- 'typeProperty',
110
- 'classMethod',
111
- 'objectLiteralMethod',
112
- 'typeMethod',
113
- 'accessor',
114
- 'enumMember',
115
- ],
116
- format: null,
117
- modifiers: ['requiresQuotes'],
118
- },
119
- ],
120
- '@typescript-eslint/ban-ts-comment': 'warn',
121
- 'no-empty-function': 'off',
122
- '@typescript-eslint/no-empty-function': 'warn',
123
- // standard no-unused-expressions don't understand optional chaining from ts
124
- 'no-unused-expressions': 'off',
125
- '@typescript-eslint/no-unused-expressions': [
126
- 'error',
127
- {
128
- allowShortCircuit: true,
129
- allowTernary: true,
130
- },
131
- ],
132
- '@typescript-eslint/no-var-requires': 'warn',
133
- '@typescript-eslint/no-namespace': 'off',
134
- 'no-use-before-define': 'off',
135
- '@typescript-eslint/no-use-before-define': [
136
- 'error',
137
- {
138
- functions: false,
139
- classes: false,
140
- variables: true,
141
- enums: true,
142
- typedefs: true,
143
- },
144
- ],
145
- '@typescript-eslint/explicit-module-boundary-types': 'off',
146
- 'consistent-return': 'off',
147
- '@typescript-eslint/consistent-type-imports': [
148
- 'warn',
149
- {
150
- prefer: 'type-imports',
151
- disallowTypeAnnotations: true,
152
- },
153
- ],
154
- 'no-shadow': 'off',
155
- '@typescript-eslint/no-shadow': ['warn'],
156
- // conflict with import type statement, try to merge default and named imports
157
- // https://github.com/typescript-eslint/typescript-eslint/issues/2545#issuecomment-692842483
158
- // https://github.com/import-js/eslint-plugin-import/issues/2114
159
- 'import/no-duplicates': 'off',
80
+ },
81
+ ],
82
+ '@typescript-eslint/no-extraneous-class': [
83
+ 'error',
84
+ {
85
+ allowWithDecorator: true,
86
+ allowStaticOnly: true,
87
+ },
88
+ ],
89
+ '@typescript-eslint/no-explicit-any': 'off',
90
+ camelcase: 'off',
91
+ '@typescript-eslint/camelcase': 'off',
92
+ '@typescript-eslint/naming-convention': [
93
+ 'error',
94
+ {
95
+ selector: 'default',
96
+ format: ['camelCase', 'PascalCase'],
97
+ leadingUnderscore: 'allow',
98
+ trailingUnderscore: 'allow',
99
+ },
100
+ {
101
+ selector: 'variable',
102
+ format: ['camelCase', 'PascalCase', 'UPPER_CASE'],
103
+ leadingUnderscore: 'allow',
104
+ trailingUnderscore: 'allow',
105
+ },
106
+ {
107
+ selector: 'typeLike',
108
+ format: ['PascalCase', 'UPPER_CASE'],
109
+ },
110
+ {
111
+ selector: 'property',
112
+ format: ['camelCase', 'PascalCase'],
113
+ },
114
+ {
115
+ selector: [
116
+ 'classProperty',
117
+ 'objectLiteralProperty',
118
+ 'typeProperty',
119
+ 'classMethod',
120
+ 'objectLiteralMethod',
121
+ 'typeMethod',
122
+ 'accessor',
123
+ 'enumMember',
124
+ ],
125
+ format: null,
126
+ modifiers: ['requiresQuotes'],
127
+ },
128
+ ],
129
+ '@typescript-eslint/ban-ts-comment': 'warn',
130
+ 'no-empty-function': 'off',
131
+ '@typescript-eslint/no-empty-function': 'warn',
132
+ // standard no-unused-expressions don't understand optional chaining from ts
133
+ 'no-unused-expressions': 'off',
134
+ '@typescript-eslint/no-unused-expressions': [
135
+ 'error',
136
+ {
137
+ allowShortCircuit: true,
138
+ allowTernary: true,
139
+ },
140
+ ],
141
+ '@typescript-eslint/no-var-requires': 'warn',
142
+ '@typescript-eslint/no-namespace': 'off',
143
+ 'no-use-before-define': 'off',
144
+ '@typescript-eslint/no-use-before-define': [
145
+ 'error',
146
+ {
147
+ functions: false,
148
+ classes: false,
149
+ variables: true,
150
+ enums: true,
151
+ typedefs: true,
152
+ },
153
+ ],
154
+ '@typescript-eslint/explicit-module-boundary-types': 'off',
155
+ 'consistent-return': 'off',
156
+ '@typescript-eslint/consistent-type-imports': [
157
+ 'warn',
158
+ {
159
+ prefer: 'type-imports',
160
+ disallowTypeAnnotations: true,
161
+ },
162
+ ],
163
+ 'no-shadow': 'off',
164
+ '@typescript-eslint/no-shadow': ['warn'],
165
+ // conflict with import type statement, try to merge default and named imports
166
+ // https://github.com/typescript-eslint/typescript-eslint/issues/2545#issuecomment-692842483
167
+ // https://github.com/import-js/eslint-plugin-import/issues/2114
168
+ 'import/no-duplicates': 'off',
169
+ },
170
+ settings: {
171
+ 'import/parsers': {
172
+ '@typescript-eslint/parser': ['.ts', '.tsx'],
160
173
  },
161
174
  },
162
- ],
163
- };
175
+ },
176
+ ];
package/jest.js CHANGED
@@ -1,19 +1,20 @@
1
- module.exports = {
2
- extends: ['plugin:jest/recommended'],
1
+ import jestPlugin from 'eslint-plugin-jest';
3
2
 
4
- plugins: [],
5
-
6
- rules: {
7
- 'jest/expect-expect': [
8
- 'warn',
9
- {
10
- assertFunctionNames: [
11
- 'expect',
12
- // support superagent library
13
- 'request.**.expect',
14
- ],
15
- },
16
- ],
17
- 'jest/no-disabled-tests': 'off',
3
+ export default [
4
+ jestPlugin.configs['flat/recommended'],
5
+ {
6
+ rules: {
7
+ 'jest/expect-expect': [
8
+ 'warn',
9
+ {
10
+ assertFunctionNames: [
11
+ 'expect',
12
+ // support superagent library
13
+ 'request.**.expect',
14
+ ],
15
+ },
16
+ ],
17
+ 'jest/no-disabled-tests': 'off',
18
+ },
18
19
  },
19
- };
20
+ ];
package/lib.js CHANGED
@@ -1,12 +1,13 @@
1
- module.exports = {
2
- extends: ['./index'],
1
+ import index from './index.js';
3
2
 
4
- plugins: [],
5
-
6
- rules: {
7
- 'import/no-dynamic-require': 'off',
8
- 'import/no-deprecated': 'off',
9
- '@typescript-eslint/no-var-requires': 'off',
10
- '@typescript-eslint/no-empty-function': 'off',
3
+ export default [
4
+ ...index,
5
+ {
6
+ rules: {
7
+ 'import/no-dynamic-require': 'off',
8
+ 'import/no-deprecated': 'off',
9
+ '@typescript-eslint/no-var-requires': 'off',
10
+ '@typescript-eslint/no-empty-function': 'off',
11
+ },
11
12
  },
12
- };
13
+ ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinkoff/eslint-config",
3
- "version": "5.2.0",
3
+ "version": "5.2.1",
4
4
  "description": "ESLint configs to rule them all",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [
@@ -9,28 +9,40 @@
9
9
  "eslint-config"
10
10
  ],
11
11
  "scripts": {},
12
+ "type": "module",
12
13
  "main": "index.js",
14
+ "exports": {
15
+ ".": "./index.js",
16
+ "./index": "./index.js",
17
+ "./index.js": "./index.js",
18
+ "./app": "./app.js",
19
+ "./app.js": "./app.js",
20
+ "./lib": "./lib.js",
21
+ "./lib.js": "./lib.js",
22
+ "./jest": "./jest.js",
23
+ "./jest.js": "./jest.js"
24
+ },
13
25
  "repository": {
14
26
  "type": "git",
15
27
  "url": "https://github.com/tramvaijs/linters.git"
16
28
  },
17
29
  "dependencies": {
18
- "@babel/eslint-parser": "^7.21.3",
30
+ "@babel/eslint-parser": "^7.28.5",
19
31
  "@babel/eslint-plugin": "^7.19.1",
20
- "@typescript-eslint/eslint-plugin": "^8.0.0",
21
- "@typescript-eslint/parser": "^8.0.0",
22
- "eslint": "^8.38.0",
23
- "eslint-config-airbnb-base": "^15.0.0",
24
- "eslint-config-prettier": "^9.1.0",
32
+ "@eslint-community/eslint-plugin-eslint-comments": "^4.7.1",
33
+ "eslint": "^9.0.0",
34
+ "eslint-config-airbnb-extended": "^3.1.0",
35
+ "eslint-config-prettier": "^10.1.8",
25
36
  "eslint-import-resolver-typescript": "^3.5.5",
26
37
  "eslint-import-resolver-webpack": "^0.13.2",
27
- "eslint-plugin-eslint-comments": "^3.2.0",
28
- "eslint-plugin-import": "^2.27.5",
29
- "eslint-plugin-jest": "^28.0.0",
38
+ "eslint-plugin-import": "^2.32.0",
39
+ "eslint-plugin-jest": "^29.0.0",
30
40
  "eslint-plugin-prettier": "^5.1.3",
31
- "eslint-plugin-promise": "^6.1.1",
32
- "eslint-plugin-sort-class-members": "^1.17.1",
33
- "prettier": "^3.2.5"
41
+ "eslint-plugin-promise": "^7.2.1",
42
+ "eslint-plugin-sort-class-members": "^1.21.0",
43
+ "globals": "^15.0.0",
44
+ "prettier": "^3.2.5",
45
+ "typescript-eslint": "^8.59.0"
34
46
  },
35
47
  "publishConfig": {
36
48
  "access": "public"
@@ -38,5 +50,5 @@
38
50
  "devDependencies": {
39
51
  "eslint-formatter-codeframe": "^7.32.1"
40
52
  },
41
- "gitHead": "f1773195e3691b5b42258369501281e3b0c2d4cc"
53
+ "gitHead": "9fc4e06626008bb3a5e2245b7799566ac29be15c"
42
54
  }