@dmitryrechkin/eslint-standard 1.5.11 → 1.5.13
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.
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ESLint 9.x Flat Config for @dmitryrechkin/eslint-standard
|
|
3
|
+
*/
|
|
4
|
+
import type { Linter } from 'eslint';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Configuration options for ESLint standard setup
|
|
8
|
+
*/
|
|
9
|
+
export interface TypeEslintStandardOptions
|
|
10
|
+
{
|
|
11
|
+
/**
|
|
12
|
+
* Path to the TypeScript config file for ESLint type-aware rules.
|
|
13
|
+
* @default './tsconfig.json'
|
|
14
|
+
*/
|
|
15
|
+
tsconfigPath?: string;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Additional patterns to ignore.
|
|
19
|
+
* @default []
|
|
20
|
+
*/
|
|
21
|
+
ignores?: string[];
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* File patterns to apply this config to.
|
|
25
|
+
* @default []
|
|
26
|
+
*/
|
|
27
|
+
files?: string[];
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Additional ESLint plugins to include.
|
|
31
|
+
* @default {}
|
|
32
|
+
*/
|
|
33
|
+
plugins?: Record<string, unknown>;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Additional ESLint rules to override or extend defaults.
|
|
37
|
+
* @default {}
|
|
38
|
+
*/
|
|
39
|
+
rules?: Record<string, unknown>;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Whether to enable strict mode (architecture enforcement).
|
|
43
|
+
* @default false
|
|
44
|
+
*/
|
|
45
|
+
strict?: boolean;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* External prettier plugin to use instead of the bundled one.
|
|
49
|
+
* Pass in the prettier plugin from your consuming project for optimal compatibility.
|
|
50
|
+
*/
|
|
51
|
+
prettierPlugin?: unknown;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Creates an ESLint flat config array with standard rules.
|
|
56
|
+
* @param {TypeEslintStandardOptions} options - Configuration options for ESLint standard
|
|
57
|
+
* @returns {Linter.Config[]} Array of ESLint configuration objects
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```ts
|
|
61
|
+
* import eslintConfig from '@dmitryrechkin/eslint-standard';
|
|
62
|
+
*
|
|
63
|
+
* export default eslintConfig({
|
|
64
|
+
* tsconfigPath: './tsconfig.json'
|
|
65
|
+
* });
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```ts
|
|
70
|
+
* import eslintConfig from '@dmitryrechkin/eslint-standard';
|
|
71
|
+
* import prettierPlugin from 'eslint-plugin-prettier';
|
|
72
|
+
*
|
|
73
|
+
* export default eslintConfig({
|
|
74
|
+
* strict: true,
|
|
75
|
+
* prettierPlugin
|
|
76
|
+
* });
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
declare function eslintStandard(
|
|
80
|
+
options?: TypeEslintStandardOptions
|
|
81
|
+
): Linter.Config[];
|
|
82
|
+
|
|
83
|
+
export default eslintStandard;
|
package/eslint.config.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// eslint.config.mjs
|
|
2
2
|
//
|
|
3
|
-
// ESLint 9.x Flat Config for @dmitryrechkin/eslint-standard
|
|
3
|
+
// ESLint 9.x / 10.x Flat Config for @dmitryrechkin/eslint-standard
|
|
4
4
|
//
|
|
5
5
|
// For optimal compatibility, pass the prettier plugin from your consuming project:
|
|
6
6
|
//
|
|
@@ -21,16 +21,16 @@ import switchCaseBracePlugin from './src/plugins/switch-case-brace.mjs';
|
|
|
21
21
|
import securityPlugin from 'eslint-plugin-security';
|
|
22
22
|
import jsxA11yPlugin from 'eslint-plugin-jsx-a11y';
|
|
23
23
|
import promisePlugin from 'eslint-plugin-promise';
|
|
24
|
-
import importPlugin from 'eslint-plugin-import';
|
|
24
|
+
import importPlugin from 'eslint-plugin-import-x';
|
|
25
25
|
import sonarjsPlugin from 'eslint-plugin-sonarjs';
|
|
26
26
|
import unicornPlugin from 'eslint-plugin-unicorn';
|
|
27
27
|
import noSecretsPlugin from 'eslint-plugin-no-secrets';
|
|
28
28
|
import regexpPlugin from 'eslint-plugin-regexp';
|
|
29
29
|
import functionalPlugin from 'eslint-plugin-functional';
|
|
30
30
|
import standardConventionsPlugin from './src/plugins/standard-conventions.mjs';
|
|
31
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
31
|
+
// eslint-disable-next-line import-x/no-extraneous-dependencies
|
|
32
32
|
import prettierConfig from 'eslint-config-prettier';
|
|
33
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
33
|
+
// eslint-disable-next-line import-x/no-extraneous-dependencies
|
|
34
34
|
import prettierPlugin from 'eslint-plugin-prettier';
|
|
35
35
|
|
|
36
36
|
export default function ({
|
|
@@ -74,7 +74,7 @@ export default function ({
|
|
|
74
74
|
'security': securityPlugin,
|
|
75
75
|
'jsx-a11y': jsxA11yPlugin,
|
|
76
76
|
'promise': promisePlugin,
|
|
77
|
-
'import': importPlugin,
|
|
77
|
+
'import-x': importPlugin,
|
|
78
78
|
'sonarjs': sonarjsPlugin,
|
|
79
79
|
'unicorn': unicornPlugin,
|
|
80
80
|
'no-secrets': noSecretsPlugin,
|
|
@@ -85,15 +85,15 @@ export default function ({
|
|
|
85
85
|
...plugins,
|
|
86
86
|
},
|
|
87
87
|
settings: {
|
|
88
|
-
'import/resolver': {
|
|
88
|
+
'import-x/resolver': {
|
|
89
89
|
node: {
|
|
90
90
|
extensions: ['.js', '.jsx', '.ts', '.tsx'],
|
|
91
91
|
},
|
|
92
92
|
},
|
|
93
|
-
'import/parsers': {
|
|
93
|
+
'import-x/parsers': {
|
|
94
94
|
'@typescript-eslint/parser': ['.ts', '.tsx'],
|
|
95
95
|
},
|
|
96
|
-
'import/extensions': ['.js', '.jsx', '.ts', '.tsx'],
|
|
96
|
+
'import-x/extensions': ['.js', '.jsx', '.ts', '.tsx'],
|
|
97
97
|
},
|
|
98
98
|
rules: {
|
|
99
99
|
// Prettier integration
|
|
@@ -591,49 +591,48 @@ export default function ({
|
|
|
591
591
|
'promise/prefer-await-to-then': 'warn',
|
|
592
592
|
'promise/prefer-await-to-callbacks': 'warn',
|
|
593
593
|
|
|
594
|
-
// Import plugin rules
|
|
595
|
-
'import/no-unresolved': 'off', // Too many false positives with TypeScript
|
|
596
|
-
'import/named': 'error',
|
|
597
|
-
'import/default': 'error',
|
|
598
|
-
'import/namespace': 'error',
|
|
599
|
-
'import/no-restricted-paths': 'off',
|
|
600
|
-
'import/no-absolute-path': 'error',
|
|
601
|
-
'import/no-dynamic-require': 'error',
|
|
602
|
-
'import/no-internal-modules': 'off',
|
|
603
|
-
'import/no-webpack-loader-syntax': 'error',
|
|
604
|
-
'import/no-self-import': 'error',
|
|
605
|
-
'import/no-cycle': ['error', { maxDepth: 3 }],
|
|
606
|
-
'import/no-useless-path-segments': 'error',
|
|
607
|
-
'import/no-relative-parent-imports': 'off',
|
|
608
|
-
'import/export': 'error',
|
|
609
|
-
'import/no-named-as-default': 'error',
|
|
610
|
-
'import/no-named-as-default-member': 'error',
|
|
611
|
-
'import/no-deprecated': 'warn',
|
|
612
|
-
'import/no-extraneous-dependencies': ['error', {
|
|
594
|
+
// Import plugin rules (eslint-plugin-import-x)
|
|
595
|
+
'import-x/no-unresolved': 'off', // Too many false positives with TypeScript
|
|
596
|
+
'import-x/named': 'error',
|
|
597
|
+
'import-x/default': 'error',
|
|
598
|
+
'import-x/namespace': 'error',
|
|
599
|
+
'import-x/no-restricted-paths': 'off',
|
|
600
|
+
'import-x/no-absolute-path': 'error',
|
|
601
|
+
'import-x/no-dynamic-require': 'error',
|
|
602
|
+
'import-x/no-internal-modules': 'off',
|
|
603
|
+
'import-x/no-webpack-loader-syntax': 'error',
|
|
604
|
+
'import-x/no-self-import': 'error',
|
|
605
|
+
'import-x/no-cycle': ['error', { maxDepth: 3 }],
|
|
606
|
+
'import-x/no-useless-path-segments': 'error',
|
|
607
|
+
'import-x/no-relative-parent-imports': 'off',
|
|
608
|
+
'import-x/export': 'error',
|
|
609
|
+
'import-x/no-named-as-default': 'error',
|
|
610
|
+
'import-x/no-named-as-default-member': 'error',
|
|
611
|
+
'import-x/no-deprecated': 'warn',
|
|
612
|
+
'import-x/no-extraneous-dependencies': ['error', {
|
|
613
613
|
devDependencies: ['**/*.test.{js,jsx,ts,tsx}', '**/*.spec.{js,jsx,ts,tsx}', '**/test/**', '**/tests/**', '**/__tests__/**']
|
|
614
614
|
}],
|
|
615
|
-
'import/no-mutable-exports': 'error',
|
|
616
|
-
|
|
617
|
-
'import/
|
|
618
|
-
'import/no-
|
|
619
|
-
'import/no-
|
|
620
|
-
'import/
|
|
621
|
-
'import/
|
|
622
|
-
'import/
|
|
623
|
-
'import/no-
|
|
624
|
-
'import/
|
|
625
|
-
'import/
|
|
626
|
-
'import/
|
|
627
|
-
'import/
|
|
628
|
-
'import/
|
|
629
|
-
'import/no-
|
|
630
|
-
'import/no-
|
|
631
|
-
'import/no-
|
|
632
|
-
'import/no-
|
|
633
|
-
'import/
|
|
634
|
-
'import/
|
|
635
|
-
'import/
|
|
636
|
-
'import/order': 'off', // Disabled - conflicts with simple-import-sort plugin
|
|
615
|
+
'import-x/no-mutable-exports': 'error',
|
|
616
|
+
'import-x/unambiguous': 'off',
|
|
617
|
+
'import-x/no-commonjs': 'off',
|
|
618
|
+
'import-x/no-amd': 'error',
|
|
619
|
+
'import-x/no-nodejs-modules': 'off',
|
|
620
|
+
'import-x/first': 'error',
|
|
621
|
+
'import-x/exports-last': 'off',
|
|
622
|
+
'import-x/no-duplicates': 'error',
|
|
623
|
+
'import-x/no-namespace': 'off',
|
|
624
|
+
'import-x/extensions': 'off', // Disabled - TypeScript handles this, causes issues with test files and relative imports
|
|
625
|
+
'import-x/newline-after-import': 'error',
|
|
626
|
+
'import-x/prefer-default-export': 'off',
|
|
627
|
+
'import-x/max-dependencies': ['warn', { max: 20 }],
|
|
628
|
+
'import-x/no-unassigned-import': 'off',
|
|
629
|
+
'import-x/no-named-default': 'error',
|
|
630
|
+
'import-x/no-default-export': 'off',
|
|
631
|
+
'import-x/no-named-export': 'off',
|
|
632
|
+
'import-x/no-anonymous-default-export': 'warn',
|
|
633
|
+
'import-x/group-exports': 'off',
|
|
634
|
+
'import-x/dynamic-import-chunkname': 'off',
|
|
635
|
+
'import-x/order': 'off', // Disabled - conflicts with simple-import-sort plugin
|
|
637
636
|
|
|
638
637
|
// JSX A11y plugin rules (only active for React/JSX files)
|
|
639
638
|
'jsx-a11y/alt-text': 'error',
|
package/package.json
CHANGED
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dmitryrechkin/eslint-standard",
|
|
3
3
|
"description": "This package provides a shared ESLint configuration which includes TypeScript support and a set of specific linting rules designed to ensure high-quality and consistent code style across projects.",
|
|
4
|
-
"version": "1.5.
|
|
4
|
+
"version": "1.5.13",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "eslint.config.mjs",
|
|
7
|
+
"types": "./eslint.config.d.ts",
|
|
7
8
|
"exports": {
|
|
8
|
-
".":
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./eslint.config.mjs",
|
|
11
|
+
"types": "./eslint.config.d.ts"
|
|
12
|
+
}
|
|
9
13
|
},
|
|
10
14
|
"bin": {
|
|
11
15
|
"eslint-standard": "./src/cli/index.mjs"
|
|
12
16
|
},
|
|
13
17
|
"files": [
|
|
14
18
|
"eslint.config.mjs",
|
|
19
|
+
"eslint.config.d.ts",
|
|
15
20
|
"src/",
|
|
16
21
|
"README.md",
|
|
17
22
|
"LICENSE"
|
|
@@ -40,32 +45,34 @@
|
|
|
40
45
|
"author": "",
|
|
41
46
|
"license": "MIT",
|
|
42
47
|
"dependencies": {
|
|
43
|
-
"@stylistic/eslint-plugin": "^5.
|
|
44
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
45
|
-
"@typescript-eslint/parser": "^8.
|
|
48
|
+
"@stylistic/eslint-plugin": "^5.10.0",
|
|
49
|
+
"@typescript-eslint/eslint-plugin": "^8.57.1",
|
|
50
|
+
"@typescript-eslint/parser": "^8.57.1",
|
|
46
51
|
"eslint-config-prettier": "^10.1.8",
|
|
47
|
-
"eslint-
|
|
48
|
-
"eslint-plugin-
|
|
49
|
-
"eslint-plugin-
|
|
50
|
-
"eslint-plugin-jsdoc": "^61.5.0",
|
|
52
|
+
"eslint-plugin-functional": "^9.0.4",
|
|
53
|
+
"eslint-plugin-import-x": "^4.16.2",
|
|
54
|
+
"eslint-plugin-jsdoc": "^62.8.0",
|
|
51
55
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
52
|
-
"eslint-plugin-no-secrets": "^2.
|
|
53
|
-
"eslint-plugin-perfectionist": "^
|
|
54
|
-
"eslint-plugin-prettier": "^5.5.
|
|
56
|
+
"eslint-plugin-no-secrets": "^2.3.3",
|
|
57
|
+
"eslint-plugin-perfectionist": "^5.7.0",
|
|
58
|
+
"eslint-plugin-prettier": "^5.5.5",
|
|
55
59
|
"eslint-plugin-promise": "^7.2.1",
|
|
56
|
-
"eslint-plugin-regexp": "^
|
|
57
|
-
"eslint-plugin-security": "^
|
|
60
|
+
"eslint-plugin-regexp": "^3.1.0",
|
|
61
|
+
"eslint-plugin-security": "^4.0.0",
|
|
58
62
|
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
59
|
-
"eslint-plugin-sonarjs": "^
|
|
60
|
-
"eslint-plugin-unicorn": "^
|
|
61
|
-
"eslint-plugin-unused-imports": "^4.
|
|
63
|
+
"eslint-plugin-sonarjs": "^4.0.2",
|
|
64
|
+
"eslint-plugin-unicorn": "^63.0.0",
|
|
65
|
+
"eslint-plugin-unused-imports": "^4.4.1",
|
|
62
66
|
"prettier-plugin-astro": "^0.14.1",
|
|
63
|
-
"prettier-plugin-brace-style": "^0.
|
|
64
|
-
"prettier-plugin-merge": "^0.
|
|
67
|
+
"prettier-plugin-brace-style": "^0.10.0",
|
|
68
|
+
"prettier-plugin-merge": "^0.10.0"
|
|
65
69
|
},
|
|
66
70
|
"peerDependencies": {
|
|
67
|
-
"eslint": "^9.0.0",
|
|
71
|
+
"eslint": "^9.0.0 || ^10.0.0",
|
|
68
72
|
"prettier": "^3.0.0",
|
|
69
73
|
"typescript": "^5.0.0"
|
|
74
|
+
},
|
|
75
|
+
"devDependencies": {
|
|
76
|
+
"eslint": "^10.1.0"
|
|
70
77
|
}
|
|
71
|
-
}
|
|
78
|
+
}
|
|
@@ -29,7 +29,7 @@ const jsdocIndentRule = {
|
|
|
29
29
|
create(context) {
|
|
30
30
|
const options = context.options[0] || {};
|
|
31
31
|
const tabWidth = options.tabWidth || 4;
|
|
32
|
-
const sourceCode = context.sourceCode
|
|
32
|
+
const sourceCode = context.sourceCode;
|
|
33
33
|
|
|
34
34
|
return {
|
|
35
35
|
Program() {
|
|
@@ -107,7 +107,7 @@ const functionNameMatchFilenameRule = {
|
|
|
107
107
|
schema: []
|
|
108
108
|
},
|
|
109
109
|
create(context) {
|
|
110
|
-
const filename = path.basename(context.
|
|
110
|
+
const filename = path.basename(context.filename, path.extname(context.filename));
|
|
111
111
|
|
|
112
112
|
return {
|
|
113
113
|
FunctionDeclaration(node) {
|
|
@@ -157,7 +157,7 @@ const folderCamelCaseRule = {
|
|
|
157
157
|
create(context) {
|
|
158
158
|
return {
|
|
159
159
|
Program() {
|
|
160
|
-
const fullPath = context.
|
|
160
|
+
const fullPath = context.filename;
|
|
161
161
|
|
|
162
162
|
if (fullPath === '<input>' || fullPath === '<text>') {
|
|
163
163
|
return;
|
|
@@ -353,7 +353,7 @@ const classLocationRule = {
|
|
|
353
353
|
}
|
|
354
354
|
|
|
355
355
|
const className = node.id.name;
|
|
356
|
-
const fullPath = context.
|
|
356
|
+
const fullPath = context.filename;
|
|
357
357
|
|
|
358
358
|
if (fullPath === '<input>' || fullPath === '<text>') {
|
|
359
359
|
return;
|
|
@@ -414,7 +414,7 @@ const typeLocationRule = {
|
|
|
414
414
|
return;
|
|
415
415
|
}
|
|
416
416
|
|
|
417
|
-
const fullPath = context.
|
|
417
|
+
const fullPath = context.filename;
|
|
418
418
|
|
|
419
419
|
if (fullPath === '<input>' || fullPath === '<text>') {
|
|
420
420
|
return;
|
|
@@ -443,7 +443,7 @@ const typeLocationRule = {
|
|
|
443
443
|
return;
|
|
444
444
|
}
|
|
445
445
|
|
|
446
|
-
const fullPath = context.
|
|
446
|
+
const fullPath = context.filename;
|
|
447
447
|
|
|
448
448
|
if (fullPath === '<input>' || fullPath === '<text>') {
|
|
449
449
|
return;
|
|
@@ -1098,7 +1098,7 @@ const noUtilsFolderRule = {
|
|
|
1098
1098
|
create(context) {
|
|
1099
1099
|
return {
|
|
1100
1100
|
Program(node) {
|
|
1101
|
-
const fullPath = context.
|
|
1101
|
+
const fullPath = context.filename;
|
|
1102
1102
|
|
|
1103
1103
|
if (fullPath === '<input>' || fullPath === '<text>') {
|
|
1104
1104
|
return;
|