@tinkoff/eslint-config 5.0.1 → 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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,23 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ### [5.2.1](https://github.com/tramvaijs/linters/compare/v5.2.0...v5.2.1) (2026-04-23)
7
+
8
+ **Note:** Version bump only for package @tinkoff/eslint-config
9
+
10
+
11
+
12
+
13
+
14
+ ## [5.2.0](https://github.com/tramvaijs/linters/compare/v5.1.0...v5.2.0) (2026-03-04)
15
+
16
+
17
+ ### Features
18
+
19
+ * **eslint-config:** support mjs extension for resolver ([311578e](https://github.com/tramvaijs/linters/commit/311578e57a578cb942fc2f88135850620ae0e591))
20
+
21
+
22
+
6
23
  ### [5.0.1](https://github.com/tramvaijs/linters/compare/v5.0.0...v5.0.1) (2025-01-09)
7
24
 
8
25
 
package/README.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # @tinkoff/eslint-config
2
2
 
3
- ESlint plugin includes rules for JS and TS codebase. Better to use with framework-oriented packages `@tinkoff/eslint-config-react` or `@tinkoff/eslint-config-angular`
3
+ ESLint config includes rules for JS and TS codebase. Better to use with framework-oriented packages `@tinkoff/eslint-config-react` or `@tinkoff/eslint-config-angular`.
4
+
5
+ ## Requirements
6
+
7
+ ESLint >= 9 is required.
4
8
 
5
9
  ## Usage
6
10
 
@@ -10,62 +14,60 @@ Install from npm
10
14
  npm i --save-dev @tinkoff/eslint-config
11
15
  ```
12
16
 
13
- Then, need to include necessary configurations sets to `.eslintrc`. Wee need to choose base configuration, and any
14
- necessary additional configs. Package include eslint and prettier dependencies, so you should remove eslint, prettier from your project package.json because those packages are transitive dependencies.
17
+ Create `eslint.config.js` at the project root. Package includes eslint and prettier as dependencies, so you should remove them from your project `package.json`.
15
18
 
16
19
  ### Base configurations
17
20
 
18
21
  #### For application
19
22
 
20
- ```bash
21
- {
22
- "extends": ["@tinkoff/eslint-config/app"]
23
- }
23
+ ```js
24
+ import appConfig from '@tinkoff/eslint-config/app';
25
+
26
+ export default [...appConfig];
24
27
  ```
25
28
 
26
29
  #### For library
27
30
 
28
- ```bash
29
- {
30
- "extends": ["@tinkoff/eslint-config/lib"]
31
- }
31
+ ```js
32
+ import libConfig from '@tinkoff/eslint-config/lib';
33
+
34
+ export default [...libConfig];
32
35
  ```
33
36
 
34
37
  ### Additional configurations
35
38
 
36
- #### If we use Jest
39
+ #### With Jest
37
40
 
38
- ```bash
39
- {
40
- "extends": ["@tinkoff/eslint-config/app", "@tinkoff/eslint-config/jest"]
41
- }
41
+ ```js
42
+ import appConfig from '@tinkoff/eslint-config/app';
43
+ import jestConfig from '@tinkoff/eslint-config/jest';
44
+
45
+ export default [...appConfig, ...jestConfig];
42
46
  ```
43
47
 
44
48
  ## Configurations overview
45
49
 
46
- Main configurations sets contains common rules
50
+ Main configurations include common rules:
47
51
 
48
- - `@tinkoff/eslint-config/app` - common rules and specific rules for applications
49
- - `@tinkoff/eslint-config/lib` - common rules and specific rules for libraries
52
+ - `@tinkoff/eslint-config/app` common rules and specific rules for applications
53
+ - `@tinkoff/eslint-config/lib` common rules and specific rules for libraries
50
54
 
51
- Additional configurations sets. This configs **not** contain common eslint rules, and must be included with main
52
- configurations
55
+ Additional configurations. These configs **do not** include common eslint rules and must be included alongside main configurations:
53
56
 
54
- - `@tinkoff/eslint-config/jest` - rules for lint Jest test suits
57
+ - `@tinkoff/eslint-config/jest` rules for linting Jest test suites
55
58
 
56
59
  ## Internal used plugins
57
60
 
58
61
  `@tinkoff/eslint-config/app` and `@tinkoff/eslint-config/lib` include:
59
62
 
60
- - `eslint-config-airbnb` - common and popular configuration
61
- - `eslint-plugin-eslint-comments` - validate `eslint` comments
62
- - `eslint-plugin-import` - validate proper imports
63
- - `eslint-plugin-promise` - enforce best practices for promises
64
- - `eslint-plugin-jest` - validate jest tests
65
- - `@typescript-eslint/eslint-plugin` - lint TypeScript files, adopt many eslint rules to TS code, and provide specific
66
- TS rules
67
- - `eslint-plugin-prettier` - disable code formatting using eslint tools and transfers all the logic to a prettier, and
68
- report differences as eslint issues
63
+ - `eslint-config-airbnb-extended` updated version of common and popular configuration `eslint-config-airbnb`
64
+ - `@eslint-community/eslint-plugin-eslint-comments` validate `eslint` comments
65
+ - `eslint-plugin-import` validate proper imports
66
+ - `eslint-plugin-promise` enforce best practices for promises
67
+ - `eslint-plugin-jest` validate jest tests
68
+ - `@typescript-eslint/eslint-plugin` lint TypeScript files, adopt many eslint rules to TS code, and provide specific TS rules
69
+ - `eslint-plugin-prettier` — disable code formatting using eslint tools and transfer all the logic to prettier,
70
+ and report differences as eslint issues
69
71
 
70
72
  ## Troubleshooting
71
73
 
@@ -80,86 +82,80 @@ then reinstall dependencies.
80
82
 
81
83
  #### In root config
82
84
 
83
- 1. Add `"@tinkoff/eslint-config"` to extends section on config.
84
- 2. Set parserOptions.project for typescript files
85
+ Create `eslint.config.js` at the workspace root:
85
86
 
86
- ```json5
87
- {
87
+ ```js
88
+ import appConfig from '@tinkoff/eslint-config';
88
89
 
89
- "root": true,
90
- "ignorePatterns": ["**/*"],
91
- "extends": ["@tinkoff/eslint-config"]
92
- // ...optionally some other configs
93
- "overrides": [
94
- {
95
- "files": ["*.ts", "*.tsx"],
96
- "parserOptions": {
97
- "project": ["./tsconfig.base.json"]
98
- }
99
- }
100
- ]
101
- }
90
+ export default [
91
+ ...appConfig,
92
+ {
93
+ ignores: ['**/*'],
94
+ },
95
+ ];
102
96
  ```
103
97
 
104
98
  #### In apps and non-buildable/non-publishable libs
105
99
 
106
- Add `"@tinkoff/eslint-config/app"` in extends section after root config
107
-
108
- ```json
109
- {
110
- "extends": ["../../.eslintrc.json", "@tinkoff/eslint-config/app"],
111
- "ignorePatterns": ["!**/*"]
112
- ...optionally some other configs
113
- }
114
- ```
115
-
116
- #### In buildable/publishable libs
100
+ Create `eslint.config.js` in the project directory:
117
101
 
118
- Add `"@tinkoff/eslint-config/lib"` in extends section after root config
102
+ ```js
103
+ import rootConfig from '../../eslint.config';
104
+ import appConfig from '@tinkoff/eslint-config/app';
119
105
 
120
- ```json
121
- {
122
- "extends": ["../../.eslintrc.json", "@tinkoff/eslint-config/lib"],
123
- "ignorePatterns": ["!**/*"]
124
- ...optionally some other configs
125
- }
106
+ export default [
107
+ ...rootConfig,
108
+ ...appConfig,
109
+ {
110
+ files: ['**/*.ts', '**/*.tsx'],
111
+ languageOptions: {
112
+ parserOptions: {
113
+ project: ['./tsconfig.json'],
114
+ },
115
+ },
116
+ },
117
+ ];
126
118
  ```
127
119
 
128
- ### Non-JSON configs usage
129
-
130
- Nx means usage `.eslintrc.json` for configure ESLint. Just provide it! In `.eslintrc.json` add extension of actual root config file:
120
+ #### In buildable/publishable libs
131
121
 
132
- ```
133
- {
134
- "extends": ["./.eslintrc.js"]
135
- }
122
+ ```js
123
+ import rootConfig from '../../eslint.config';
124
+ import libConfig from '@tinkoff/eslint-config/lib';
125
+
126
+ export default [
127
+ ...rootConfig,
128
+ ...libConfig,
129
+ {
130
+ files: ['**/*.ts', '**/*.tsx'],
131
+ languageOptions: {
132
+ parserOptions: {
133
+ project: ['./tsconfig.json'],
134
+ },
135
+ },
136
+ },
137
+ ];
136
138
  ```
137
139
 
138
- After that:
140
+ ### Disable false-positive detections from `import/no-unresolved`
139
141
 
140
- - Nx see what they need and don't re-initialize lint infrastructure
141
- - You can use [better config formats](https://eslint.org/docs/latest/user-guide/configuring/configuration-files#configuration-file-formats) and nx generators
142
+ Override the rule in the project's `eslint.config.js`:
142
143
 
143
- ### Disable false-positive detections from `import/no-unresolved`
144
+ ```js
145
+ import appConfig from '@tinkoff/eslint-config/app';
144
146
 
145
- override rule in `.eslintrc` of apps/libs that contains problem:
146
-
147
- ```json5
148
- {
149
- // ...some other configs...
150
- // disable detection for packages starts with @tinkoff/
151
- overrides: [
152
- {
153
- files: ['*.ts', '*.tsx', '*.js', '*.jsx'],
154
- rules: {
155
- 'import/no-unresolved': [
156
- 'error',
157
- {
158
- ignore: ['^@tinkoff/'],
159
- },
160
- ],
161
- },
147
+ export default [
148
+ ...appConfig,
149
+ {
150
+ files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
151
+ rules: {
152
+ 'import/no-unresolved': [
153
+ 'error',
154
+ {
155
+ ignore: ['^@tinkoff/'],
156
+ },
157
+ ],
162
158
  },
163
- ],
164
- }
159
+ },
160
+ ];
165
161
  ```
package/app.js CHANGED
@@ -1,7 +1,3 @@
1
- module.exports = {
2
- extends: ['./index'],
1
+ import index from './index.js';
3
2
 
4
- plugins: [],
5
-
6
- rules: {},
7
- };
3
+ export default [...index];
package/errors/index.js CHANGED
@@ -1,14 +1,17 @@
1
- module.exports = {
2
- overrides: [
3
- {
4
- files: ['*.js', '*.ts', '*.tsx'],
5
- parser: '@typescript-eslint/parser',
6
- extends: ['eslint-config-airbnb-base/rules/errors'],
7
- rules: {
8
- // eslint-config-airbnb-base/errors
9
- 'no-empty': ['error', { allowEmptyCatch: true }],
10
- 'no-await-in-loop': 'off',
11
- },
1
+ import { rules } from 'eslint-config-airbnb-extended/legacy';
2
+ import typescriptParser from '@typescript-eslint/parser';
3
+
4
+ export default [
5
+ {
6
+ files: ['**/*.js', '**/*.ts', '**/*.tsx'],
7
+ languageOptions: {
8
+ parser: typescriptParser,
12
9
  },
13
- ],
14
- };
10
+ rules: {
11
+ ...rules.base.errors.rules,
12
+ // Overrides
13
+ 'no-empty': ['error', { allowEmptyCatch: true }],
14
+ 'no-await-in-loop': 'off',
15
+ },
16
+ },
17
+ ];
package/index.js CHANGED
@@ -1,16 +1,26 @@
1
- module.exports = {
2
- extends: [
3
- './internal/base',
4
- './internal/sort-class-members',
5
- './internal/import',
6
- './internal/promise',
7
- './internal/test-files',
8
- './internal/typescript',
9
- './internal/prettier',
10
- ],
1
+ import globals from 'globals';
2
+ import base from './internal/base.js';
3
+ import sortClassMembers from './internal/sort-class-members.js';
4
+ import importConfig from './internal/import.js';
5
+ import promise from './internal/promise.js';
6
+ import testFiles from './internal/test-files.js';
7
+ import typescript from './internal/typescript.js';
8
+ import prettier from './internal/prettier.js';
11
9
 
12
- env: {
13
- browser: true,
14
- node: true,
10
+ export default [
11
+ ...base,
12
+ ...sortClassMembers,
13
+ ...importConfig,
14
+ ...promise,
15
+ ...testFiles,
16
+ ...typescript,
17
+ ...prettier,
18
+ {
19
+ languageOptions: {
20
+ globals: {
21
+ ...globals.browser,
22
+ ...globals.node,
23
+ },
24
+ },
15
25
  },
16
- };
26
+ ];
package/internal/base.js CHANGED
@@ -1,83 +1,94 @@
1
- module.exports = {
2
- extends: [
3
- 'eslint-config-airbnb-base',
4
- 'plugin:eslint-comments/recommended',
5
- '../errors/index.js',
6
- ],
1
+ import eslintCommentsPlugin from '@eslint-community/eslint-plugin-eslint-comments';
2
+ import babelParser from '@babel/eslint-parser';
3
+ import { configs } from 'eslint-config-airbnb-extended/legacy';
4
+ import errorsConfig from '../errors/index.js';
7
5
 
8
- parser: '@babel/eslint-parser',
9
-
10
- settings: {
11
- 'import/parser': '@babel/eslint-parser',
12
- },
13
-
14
- plugins: ['@babel'],
15
-
16
- parserOptions: {
17
- ecmaFeatures: {
18
- legacyDecorators: true,
6
+ export default [
7
+ ...configs.base.recommended,
8
+ ...errorsConfig,
9
+ {
10
+ plugins: {
11
+ 'eslint-comments': eslintCommentsPlugin,
19
12
  },
20
- requireConfigFile: false,
21
- },
22
-
23
- rules: {
24
- 'no-unused-expressions': [
25
- 'error',
26
- {
27
- allowShortCircuit: true,
28
- allowTernary: true,
13
+ languageOptions: {
14
+ parser: babelParser,
15
+ parserOptions: {
16
+ ecmaFeatures: {
17
+ legacyDecorators: true,
18
+ },
19
+ requireConfigFile: false,
29
20
  },
30
- ],
31
- 'no-use-before-define': [
32
- 'error',
33
- {
34
- functions: false,
35
- classes: false,
36
- variables: true,
37
- },
38
- ],
39
- 'func-name-matching': 'off',
40
- 'global-require': 'off',
41
- 'class-methods-use-this': 'off',
42
- 'no-continue': 'off',
43
- 'no-restricted-syntax': 'off',
44
- 'guard-for-in': 'off',
45
- 'default-case': 'off',
46
- 'no-plusplus': 'off',
47
- 'func-names': 'off',
48
- 'consistent-return': 'warn',
49
- 'vars-on-top': 'warn',
50
- 'no-var': 'warn',
51
- camelcase: [
52
- 'warn',
53
- {
54
- allow: ['^UNSAFE_'],
55
- ignoreDestructuring: false,
56
- properties: 'never',
57
- },
58
- ],
59
- 'func-style': [
60
- 'error',
61
- 'declaration',
62
- {
63
- allowArrowFunctions: true,
21
+ },
22
+ settings: {
23
+ 'import/parser': {
24
+ '@babel/eslint-parser': ['.js', '.jsx', '.ts', '.tsx'],
64
25
  },
65
- ],
66
- 'max-depth': 'off',
67
- 'max-params': 'off',
68
- 'max-classes-per-file': ['error', 4],
69
- complexity: ['error', 25],
70
- 'max-statements': ['error', 25],
71
- 'no-underscore-dangle': 'off',
72
- 'no-return-assign': ['error', 'except-parens'],
73
- 'lines-between-class-members': [
74
- 'error',
75
- 'always',
76
- { exceptAfterSingleLine: true },
77
- ],
78
- 'spaced-comment': ['error', 'always', { exceptions: ['*'] }],
79
- 'max-nested-callbacks': ['error', 4],
80
- 'no-bitwise': 'warn',
81
- 'no-useless-escape': 'warn',
26
+ },
27
+ rules: {
28
+ 'eslint-comments/disable-enable-pair': 'error',
29
+ 'eslint-comments/no-aggregating-enable': 'error',
30
+ 'eslint-comments/no-duplicate-disable': 'error',
31
+ 'eslint-comments/no-unlimited-disable': 'error',
32
+ 'eslint-comments/no-unused-enable': 'error',
33
+
34
+ 'no-unused-expressions': [
35
+ 'error',
36
+ {
37
+ allowShortCircuit: true,
38
+ allowTernary: true,
39
+ },
40
+ ],
41
+ 'no-use-before-define': [
42
+ 'error',
43
+ {
44
+ functions: false,
45
+ classes: false,
46
+ variables: true,
47
+ },
48
+ ],
49
+ 'func-name-matching': 'off',
50
+ 'global-require': 'off',
51
+ 'class-methods-use-this': 'off',
52
+ 'no-continue': 'off',
53
+ 'no-restricted-syntax': 'off',
54
+ 'guard-for-in': 'off',
55
+ 'default-case': 'off',
56
+ 'no-plusplus': 'off',
57
+ 'func-names': 'off',
58
+ 'consistent-return': 'warn',
59
+ 'vars-on-top': 'warn',
60
+ 'no-var': 'warn',
61
+ camelcase: [
62
+ 'warn',
63
+ {
64
+ allow: ['^UNSAFE_'],
65
+ ignoreDestructuring: false,
66
+ properties: 'never',
67
+ },
68
+ ],
69
+ 'func-style': [
70
+ 'error',
71
+ 'declaration',
72
+ {
73
+ allowArrowFunctions: true,
74
+ },
75
+ ],
76
+ 'max-depth': 'off',
77
+ 'max-params': 'off',
78
+ 'max-classes-per-file': ['error', 4],
79
+ complexity: ['error', 25],
80
+ 'max-statements': ['error', 25],
81
+ 'no-underscore-dangle': 'off',
82
+ 'no-return-assign': ['error', 'except-parens'],
83
+ 'lines-between-class-members': [
84
+ 'error',
85
+ 'always',
86
+ { exceptAfterSingleLine: true },
87
+ ],
88
+ 'spaced-comment': ['error', 'always', { exceptions: ['*'] }],
89
+ 'max-nested-callbacks': ['error', 4],
90
+ 'no-bitwise': 'warn',
91
+ 'no-useless-escape': 'warn',
92
+ },
82
93
  },
83
- };
94
+ ];
@@ -1,34 +1,45 @@
1
- module.exports = {
2
- plugins: ['import'],
1
+ import importPlugin from 'eslint-plugin-import';
3
2
 
4
- settings: {
5
- 'import/resolver': {
6
- node: {
7
- extensions: ['.js', '.ts'],
8
- },
9
- typescript: {},
10
- webpack: {},
3
+ export default [
4
+ {
5
+ plugins: {
6
+ import: importPlugin,
11
7
  },
12
- },
13
8
 
14
- rules: {
15
- 'import/no-commonjs': 'off',
16
- 'import/unambiguous': 'off',
17
- 'import/prefer-default-export': 'off', // default imports is evil
18
- 'import/no-deprecated': 'warn',
19
- 'import/default': 'error', // enable default import validation
20
- 'import/extensions': [
21
- 'error',
22
- 'always',
23
- {
24
- js: 'never',
25
- jsx: 'never',
26
- ts: 'never',
27
- tsx: 'never',
9
+ settings: {
10
+ 'import/resolver': {
11
+ node: {
12
+ extensions: ['.js', '.mjs', '.cjs', '.ts'],
13
+ },
14
+ typescript: {},
15
+ webpack: {},
28
16
  },
29
- ],
30
- 'import/order': ['warn', { groups: [['builtin', 'external', 'internal']] }],
31
- 'import/no-extraneous-dependencies': 'off', // need fine tuning
32
- 'import/no-cycle': 'error',
17
+ },
18
+
19
+ rules: {
20
+ 'import/no-commonjs': 'off',
21
+ 'import/unambiguous': 'off',
22
+ 'import/prefer-default-export': 'off', // default imports is evil
23
+ 'import/no-deprecated': 'warn',
24
+ 'import/default': 'error', // enable default import validation
25
+ 'import/extensions': [
26
+ 'error',
27
+ 'always',
28
+ {
29
+ js: 'never',
30
+ mjs: 'never',
31
+ cjs: 'never',
32
+ jsx: 'never',
33
+ ts: 'never',
34
+ tsx: 'never',
35
+ },
36
+ ],
37
+ 'import/order': [
38
+ 'warn',
39
+ { groups: [['builtin', 'external', 'internal']] },
40
+ ],
41
+ 'import/no-extraneous-dependencies': 'off', // need fine tuning
42
+ 'import/no-cycle': 'error',
43
+ },
33
44
  },
34
- };
45
+ ];
@@ -1,3 +1,16 @@
1
- module.exports = {
2
- extends: ['plugin:prettier/recommended'],
3
- };
1
+ import prettierPlugin from 'eslint-plugin-prettier';
2
+ import prettierConfig from 'eslint-config-prettier';
3
+
4
+ export default [
5
+ {
6
+ plugins: {
7
+ prettier: prettierPlugin,
8
+ },
9
+ rules: {
10
+ ...prettierConfig.rules,
11
+ 'prettier/prettier': 'error',
12
+ 'arrow-body-style': 'off',
13
+ 'prefer-arrow-callback': 'off',
14
+ },
15
+ },
16
+ ];
@@ -1,10 +1,13 @@
1
- module.exports = {
2
- extends: ['plugin:promise/recommended'],
1
+ import promisePlugin from 'eslint-plugin-promise';
3
2
 
4
- rules: {
5
- 'promise/always-return': 'off',
6
- 'promise/no-callback-in-promise': 'off',
7
- 'promise/catch-or-return': 'warn',
8
- 'promise/param-names': 'warn',
3
+ export default [
4
+ promisePlugin.configs['flat/recommended'],
5
+ {
6
+ rules: {
7
+ 'promise/always-return': 'off',
8
+ 'promise/no-callback-in-promise': 'off',
9
+ 'promise/catch-or-return': 'warn',
10
+ 'promise/param-names': 'warn',
11
+ },
9
12
  },
10
- };
13
+ ];