@perfective/eslint-config 0.30.0 → 0.31.0
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/README.adoc +185 -60
- package/README.md +53 -40
- package/config/array-func/array-func-config.d.ts +2 -0
- package/config/array-func/array-func-config.js +16 -0
- package/config/cypress/cypress-config.d.ts +10 -0
- package/config/cypress/cypress-config.js +38 -0
- package/config/cypress/index.d.ts +1 -0
- package/config/cypress/index.js +1 -0
- package/config/eslint/eslint-config.d.ts +2 -0
- package/config/eslint/eslint-config.js +8 -0
- package/config/eslint/layout-formatting-rules.d.ts +2 -0
- package/config/eslint/possible-problems-rules.d.ts +2 -0
- package/config/eslint/suggestions-rules.d.ts +2 -0
- package/config/eslint-comments/best-practices-rules.d.ts +2 -0
- package/config/eslint-comments/eslint-comments-config.d.ts +2 -0
- package/config/eslint-comments/eslint-comments-config.js +11 -0
- package/config/eslint-comments/stylistic-issues-rules.d.ts +2 -0
- package/config/import/helpful-warnings-rules.d.ts +2 -0
- package/config/import/import-config.d.ts +4 -0
- package/config/import/import-config.js +46 -0
- package/config/import/index.d.ts +1 -0
- package/config/import/index.js +1 -0
- package/config/import/module-systems-rules.d.ts +2 -0
- package/config/import/rules/no-extraneous-dependencies.d.ts +15 -0
- package/config/import/rules/no-extraneous-dependencies.js +8 -0
- package/config/import/static-analysis-rules.d.ts +2 -0
- package/config/import/style-guide-rules.d.ts +2 -0
- package/config/jest/index.d.ts +1 -0
- package/config/jest/index.js +1 -0
- package/config/jest/jest-config.d.ts +8 -0
- package/config/jest/jest-config.js +128 -0
- package/config/jest/typescript-eslint-jest-rules.d.ts +2 -0
- package/config/jest-dom/index.d.ts +1 -0
- package/config/jest-dom/index.js +1 -0
- package/config/jest-dom/jest-dom-config.d.ts +8 -0
- package/config/jest-dom/jest-dom-config.js +23 -0
- package/config/jsdoc/jsdoc-config.d.ts +3 -0
- package/config/jsdoc/jsdoc-config.js +179 -0
- package/config/node/node-config.d.ts +2 -0
- package/config/node/node-config.js +66 -0
- package/config/perfective-eslint-config.d.ts +6 -0
- package/config/perfective-eslint-config.js +45 -0
- package/config/prefer-arrow/prefer-arrow-config.d.ts +2 -0
- package/config/prefer-arrow/prefer-arrow-config.js +16 -0
- package/config/promise/promise-config.d.ts +2 -0
- package/config/promise/promise-config.js +37 -0
- package/config/rxjs/index.d.ts +1 -0
- package/config/rxjs/index.js +1 -0
- package/config/rxjs/rxjs-config.d.ts +8 -0
- package/config/rxjs/rxjs-config.js +67 -0
- package/config/security/security-config.d.ts +2 -0
- package/config/security/security-config.js +24 -0
- package/config/simple-import-sort/index.d.ts +1 -0
- package/config/simple-import-sort/index.js +1 -0
- package/{rules → config}/simple-import-sort/rules/imports.d.ts +11 -2
- package/config/simple-import-sort/simple-import-sort-config.d.ts +2 -0
- package/config/simple-import-sort/simple-import-sort-config.js +13 -0
- package/config/stylistic/js/stylistic-js-config.d.ts +2 -0
- package/config/stylistic/js/stylistic-js-config.js +200 -0
- package/config/stylistic/jsx/stylistic-jsx-config.d.ts +2 -0
- package/config/stylistic/jsx/stylistic-jsx-config.js +87 -0
- package/config/stylistic/plus/stylistic-plus-config.d.ts +2 -0
- package/config/stylistic/plus/stylistic-plus-config.js +16 -0
- package/config/stylistic/ts/stylistic-ts-config.d.ts +2 -0
- package/config/stylistic/ts/stylistic-ts-config.js +141 -0
- package/config/testing-library/index.d.ts +1 -0
- package/config/testing-library/index.js +1 -0
- package/config/testing-library/testing-library-config.d.ts +8 -0
- package/config/testing-library/testing-library-config.js +45 -0
- package/config/typescript-eslint/extension-rules.d.ts +2 -0
- package/config/typescript-eslint/index.d.ts +1 -0
- package/config/typescript-eslint/index.js +1 -0
- package/{rules → config}/typescript-eslint/rules/typescript-eslint-naming-convention.d.ts +35 -1
- package/config/typescript-eslint/supported-rules.d.ts +2 -0
- package/{rules → config}/typescript-eslint/supported-rules.js +6 -2
- package/config/typescript-eslint/typescript-eslint-config.d.ts +2 -0
- package/config/typescript-eslint/typescript-eslint-config.js +15 -0
- package/config/unicorn/index.d.ts +1 -0
- package/config/unicorn/index.js +1 -0
- package/{rules → config}/unicorn/rules/prevent-abbreviations.d.ts +14 -2
- package/config/unicorn/unicorn-config.d.ts +2 -0
- package/config/unicorn/unicorn-config.js +185 -0
- package/index.d.ts +5 -1766
- package/index.js +5 -102
- package/linter/glob.d.ts +59 -0
- package/linter/glob.js +8 -0
- package/linter/language-options.d.ts +25 -0
- package/linter/language-options.js +45 -0
- package/linter/linter-config.d.ts +13 -0
- package/linter/linter-config.js +6 -0
- package/{config → linter}/node.d.ts +3 -1
- package/{config → linter}/plugin.d.ts +6 -2
- package/package.json +37 -38
- package/config.d.ts +0 -1
- package/config.js +0 -1
- package/cypress.d.ts +0 -6
- package/cypress.js +0 -31
- package/jest-dom.d.ts +0 -1
- package/jest-dom.js +0 -8
- package/jest.d.ts +0 -7
- package/jest.js +0 -29
- package/rules/array-func/index.d.ts +0 -13
- package/rules/array-func/index.js +0 -14
- package/rules/cypress/index.d.ts +0 -29
- package/rules/cypress/index.js +0 -23
- package/rules/eslint/index.d.ts +0 -339
- package/rules/eslint/index.js +0 -6
- package/rules/eslint/layout-formatting.d.ts +0 -64
- package/rules/eslint/possible-problems.d.ts +0 -96
- package/rules/eslint/suggestions.d.ts +0 -181
- package/rules/eslint-comments/best-practices.d.ts +0 -8
- package/rules/eslint-comments/index.d.ts +0 -20
- package/rules/eslint-comments/index.js +0 -9
- package/rules/eslint-comments/stylistic-issues.d.ts +0 -9
- package/rules/import/helpful-warnings.d.ts +0 -10
- package/rules/import/index.d.ts +0 -78
- package/rules/import/index.js +0 -11
- package/rules/import/module-systems.d.ts +0 -10
- package/rules/import/rules/no-extraneous-dependencies.d.ts +0 -14
- package/rules/import/rules/no-extraneous-dependencies.js +0 -23
- package/rules/import/static-analysis.d.ts +0 -26
- package/rules/import/style-guide.d.ts +0 -33
- package/rules/jest/index.d.ts +0 -124
- package/rules/jest/index.js +0 -98
- package/rules/jest/typescript-eslint.d.ts +0 -5
- package/rules/jest-dom/index.d.ts +0 -32
- package/rules/jest-dom/index.js +0 -19
- package/rules/jsdoc/index.d.ts +0 -134
- package/rules/jsdoc/index.js +0 -161
- package/rules/n/index.d.ts +0 -66
- package/rules/n/index.js +0 -64
- package/rules/prefer-arrow/index.d.ts +0 -13
- package/rules/prefer-arrow/index.js +0 -14
- package/rules/promise/index.d.ts +0 -34
- package/rules/promise/index.js +0 -35
- package/rules/rxjs/index.d.ts +0 -60
- package/rules/rxjs/index.js +0 -60
- package/rules/security/index.d.ts +0 -21
- package/rules/security/index.js +0 -22
- package/rules/simple-import-sort/index.d.ts +0 -10
- package/rules/simple-import-sort/index.js +0 -12
- package/rules/stylistic/js/index.d.ts +0 -204
- package/rules/stylistic/js/index.js +0 -198
- package/rules/stylistic/jsx/index.d.ts +0 -87
- package/rules/stylistic/jsx/index.js +0 -81
- package/rules/stylistic/plus/index.d.ts +0 -18
- package/rules/stylistic/plus/index.js +0 -14
- package/rules/stylistic/ts/index.d.ts +0 -141
- package/rules/stylistic/ts/index.js +0 -135
- package/rules/testing-library/index.d.ts +0 -62
- package/rules/testing-library/index.js +0 -41
- package/rules/typescript-eslint/extension-rules.d.ts +0 -113
- package/rules/typescript-eslint/index.d.ts +0 -371
- package/rules/typescript-eslint/index.js +0 -9
- package/rules/typescript-eslint/supported-rules.d.ts +0 -255
- package/rules/unicorn/index.d.ts +0 -183
- package/rules/unicorn/index.js +0 -178
- package/rules.d.ts +0 -4
- package/rules.js +0 -4
- package/rxjs.d.ts +0 -6
- package/rxjs.js +0 -22
- package/testing-library.d.ts +0 -1
- package/testing-library.js +0 -8
- /package/{rules/eslint/layout-formatting.js → config/eslint/layout-formatting-rules.js} +0 -0
- /package/{rules/eslint/possible-problems.js → config/eslint/possible-problems-rules.js} +0 -0
- /package/{rules/eslint/suggestions.js → config/eslint/suggestions-rules.js} +0 -0
- /package/{rules/eslint-comments/best-practices.js → config/eslint-comments/best-practices-rules.js} +0 -0
- /package/{rules/eslint-comments/stylistic-issues.js → config/eslint-comments/stylistic-issues-rules.js} +0 -0
- /package/{rules/import/helpful-warnings.js → config/import/helpful-warnings-rules.js} +0 -0
- /package/{rules/import/module-systems.js → config/import/module-systems-rules.js} +0 -0
- /package/{rules/import/static-analysis.js → config/import/static-analysis-rules.js} +0 -0
- /package/{rules/import/style-guide.js → config/import/style-guide-rules.js} +0 -0
- /package/{rules/jest/typescript-eslint.js → config/jest/typescript-eslint-jest-rules.js} +0 -0
- /package/{rules → config}/simple-import-sort/rules/imports.js +0 -0
- /package/{rules → config}/typescript-eslint/extension-rules.js +0 -0
- /package/{rules → config}/typescript-eslint/rules/typescript-eslint-naming-convention.js +0 -0
- /package/{rules → config}/unicorn/rules/prevent-abbreviations.js +0 -0
- /package/{config → linter}/node.js +0 -0
- /package/{config → linter}/plugin.js +0 -0
package/index.js
CHANGED
|
@@ -1,102 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { jsImportNoExtraneousDependencies } from "./rules/import/rules/no-extraneous-dependencies.js";
|
|
7
|
-
import { jsdocConfig } from "./rules/jsdoc/index.js";
|
|
8
|
-
import { nConfig } from "./rules/n/index.js";
|
|
9
|
-
import { preferArrowConfig } from "./rules/prefer-arrow/index.js";
|
|
10
|
-
import { promiseConfig } from "./rules/promise/index.js";
|
|
11
|
-
import { securityConfig } from "./rules/security/index.js";
|
|
12
|
-
import { simpleImportSortConfig } from "./rules/simple-import-sort/index.js";
|
|
13
|
-
import { stylisticJsConfig } from "./rules/stylistic/js/index.js";
|
|
14
|
-
import { stylisticJsxConfig } from "./rules/stylistic/jsx/index.js";
|
|
15
|
-
import { stylisticPlusConfig } from "./rules/stylistic/plus/index.js";
|
|
16
|
-
import { stylisticTsConfig } from "./rules/stylistic/ts/index.js";
|
|
17
|
-
import { typescriptEslintConfig } from "./rules/typescript-eslint/index.js";
|
|
18
|
-
import { unicornConfig } from "./rules/unicorn/index.js";
|
|
19
|
-
export default [{
|
|
20
|
-
ignores: ['**/*.d.ts', '**/dist']
|
|
21
|
-
}, {
|
|
22
|
-
files: ['**/*.[jt]s?(x)'],
|
|
23
|
-
languageOptions: {
|
|
24
|
-
sourceType: 'module',
|
|
25
|
-
ecmaVersion: 'latest',
|
|
26
|
-
parser,
|
|
27
|
-
parserOptions: {
|
|
28
|
-
ecmaFeatures: {
|
|
29
|
-
globalReturn: false,
|
|
30
|
-
impliedStrict: true
|
|
31
|
-
},
|
|
32
|
-
projectService: {
|
|
33
|
-
allowDefaultProject: ['?(.)*.?(m|c)js']
|
|
34
|
-
},
|
|
35
|
-
warnOnUnsupportedTypeScriptVersion: true
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
plugins: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, arrayFuncConfig.plugins), eslintCommentsConfig.plugins), importConfig.plugins), jsdocConfig.plugins), nConfig.plugins), preferArrowConfig.plugins), promiseConfig.plugins), securityConfig.plugins), simpleImportSortConfig.plugins), stylisticJsConfig.plugins), stylisticPlusConfig.plugins), unicornConfig.plugins),
|
|
39
|
-
settings: {
|
|
40
|
-
jsdoc: jsdocConfig.settings
|
|
41
|
-
},
|
|
42
|
-
rules: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, arrayFuncConfig.rules), eslintConfig.rules), eslintCommentsConfig.rules), importConfig.rules), jsdocConfig.rules), nConfig.rules), preferArrowConfig.rules), promiseConfig.rules), securityConfig.rules), simpleImportSortConfig.rules), stylisticJsConfig.rules), stylisticPlusConfig.rules), unicornConfig.rules)
|
|
43
|
-
}, {
|
|
44
|
-
files: ['**/*.js?(x)'],
|
|
45
|
-
languageOptions: {
|
|
46
|
-
sourceType: 'module',
|
|
47
|
-
ecmaVersion: 'latest',
|
|
48
|
-
parserOptions: {
|
|
49
|
-
ecmaFeatures: {
|
|
50
|
-
globalReturn: false,
|
|
51
|
-
impliedStrict: true
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
plugins: {},
|
|
56
|
-
settings: {
|
|
57
|
-
'import/extensions': ['.js', '.jsx']
|
|
58
|
-
},
|
|
59
|
-
rules: {
|
|
60
|
-
'import/no-commonjs': 'off',
|
|
61
|
-
'import/no-extraneous-dependencies': ['error', jsImportNoExtraneousDependencies()],
|
|
62
|
-
'import/unambiguous': 'off',
|
|
63
|
-
'jsdoc/no-types': 'off',
|
|
64
|
-
'jsdoc/no-undefined-types': 'off',
|
|
65
|
-
'jsdoc/require-param': 'error',
|
|
66
|
-
'jsdoc/require-param-type': 'error',
|
|
67
|
-
'jsdoc/require-returns': 'error',
|
|
68
|
-
'jsdoc/require-returns-type': 'error'
|
|
69
|
-
}
|
|
70
|
-
}, {
|
|
71
|
-
files: ['**/*.ts?(x)'],
|
|
72
|
-
languageOptions: {
|
|
73
|
-
sourceType: 'module',
|
|
74
|
-
ecmaVersion: 'latest',
|
|
75
|
-
parser,
|
|
76
|
-
parserOptions: {
|
|
77
|
-
ecmaFeatures: {
|
|
78
|
-
globalReturn: false,
|
|
79
|
-
impliedStrict: true
|
|
80
|
-
},
|
|
81
|
-
projectService: true,
|
|
82
|
-
warnOnUnsupportedTypeScriptVersion: true
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
plugins: Object.assign(Object.assign({}, typescriptEslintConfig.plugins), stylisticTsConfig.plugins),
|
|
86
|
-
settings: {
|
|
87
|
-
'import/parsers': {
|
|
88
|
-
'@typescript-eslint/parser': ['.ts', '.tsx']
|
|
89
|
-
},
|
|
90
|
-
'import/resolver': {
|
|
91
|
-
typescript: {
|
|
92
|
-
alwaysTryTypes: true,
|
|
93
|
-
project: './tsconfig.json'
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
rules: Object.assign(Object.assign({}, typescriptEslintConfig.rules), stylisticTsConfig.rules)
|
|
98
|
-
}, {
|
|
99
|
-
files: ['**/*.[jt]sx'],
|
|
100
|
-
plugins: Object.assign({}, stylisticJsxConfig.plugins),
|
|
101
|
-
rules: Object.assign({}, stylisticJsxConfig.rules)
|
|
102
|
-
}].filter(Boolean);
|
|
1
|
+
export { perfectiveEslintConfig } from "./config/perfective-eslint-config.js";
|
|
2
|
+
export { configurationFiles, cypressFiles, javascriptFiles, jestFiles, jsxFiles, tsxFiles, typescriptDeclarationFiles, typescriptFiles } from "./linter/glob.js";
|
|
3
|
+
export { javascriptLanguageOptions, languageOptions, typescriptLanguageOptions } from "./linter/language-options.js";
|
|
4
|
+
export { linterConfig } from "./linter/linter-config.js";
|
|
5
|
+
export { hasEslintPlugin, optionalRule } from "./linter/plugin.js";
|
package/linter/glob.d.ts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Nominal type for globs pattern string.
|
|
3
|
+
*
|
|
4
|
+
* @since v0.31.0
|
|
5
|
+
*/
|
|
6
|
+
export type Glob = string;
|
|
7
|
+
/**
|
|
8
|
+
* A glob pattern for JSX files.
|
|
9
|
+
*
|
|
10
|
+
* @since v0.31.0
|
|
11
|
+
*/
|
|
12
|
+
export declare const jsxFiles: Glob;
|
|
13
|
+
/**
|
|
14
|
+
* A list of glob patterns for JS and JSX files.
|
|
15
|
+
*
|
|
16
|
+
* @since v0.31.0
|
|
17
|
+
*/
|
|
18
|
+
export declare const javascriptFiles: Glob[];
|
|
19
|
+
/**
|
|
20
|
+
* A glob pattern for TSX files.
|
|
21
|
+
*
|
|
22
|
+
* @since v0.31.0
|
|
23
|
+
*/
|
|
24
|
+
export declare const tsxFiles: Glob;
|
|
25
|
+
/**
|
|
26
|
+
* A list of glob patterns for TypeScript source files.
|
|
27
|
+
*
|
|
28
|
+
* @since v0.31.0
|
|
29
|
+
*/
|
|
30
|
+
export declare const typescriptFiles: Glob[];
|
|
31
|
+
/**
|
|
32
|
+
* A glob pattern for TypeScript declaration files.
|
|
33
|
+
*
|
|
34
|
+
* @since v0.31.0
|
|
35
|
+
*/
|
|
36
|
+
export declare const typescriptDeclarationFiles: Glob;
|
|
37
|
+
/**
|
|
38
|
+
* A glob pattern for JavaScript tools configuration files.
|
|
39
|
+
*
|
|
40
|
+
* @since v0.31.0
|
|
41
|
+
*/
|
|
42
|
+
export declare const configurationFiles: string[];
|
|
43
|
+
/**
|
|
44
|
+
* The default glob patterns Jest uses to find test files.
|
|
45
|
+
*
|
|
46
|
+
* @see https://jestjs.io/docs/configuration#testmatch-arraystring
|
|
47
|
+
*
|
|
48
|
+
* @since v0.31.0
|
|
49
|
+
*/
|
|
50
|
+
export declare const jestFiles: Glob[];
|
|
51
|
+
/**
|
|
52
|
+
* The default glob pattern Cypress uses to load test files.
|
|
53
|
+
*
|
|
54
|
+
* @see https://docs.cypress.io/app/references/configuration#e2e
|
|
55
|
+
* @see https://docs.cypress.io/guides/core-concepts/writing-and-organizing-tests.html
|
|
56
|
+
*
|
|
57
|
+
* @since v0.31.0
|
|
58
|
+
*/
|
|
59
|
+
export declare const cypressFiles: Glob;
|
package/linter/glob.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const jsxFiles = '**/*.jsx';
|
|
2
|
+
export const javascriptFiles = ['**/*.{js,cjs,mjs}', jsxFiles];
|
|
3
|
+
export const tsxFiles = '**/*.tsx';
|
|
4
|
+
export const typescriptFiles = ['**/*.{ts,cts,mts}', tsxFiles];
|
|
5
|
+
export const typescriptDeclarationFiles = '**/*.d.{ts,cts,mts}';
|
|
6
|
+
export const configurationFiles = ['**/.*.js', '**/*.config.js', '**/gulpfile.js'];
|
|
7
|
+
export const jestFiles = ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'];
|
|
8
|
+
export const cypressFiles = 'cypress/e2e/**/*.cy.{js,jsx,ts,tsx}';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Linter } from 'eslint';
|
|
2
|
+
/**
|
|
3
|
+
* Creates ESLint `languageOptions` object for all files.
|
|
4
|
+
*
|
|
5
|
+
* - Uses TypeScript ESLint parser.
|
|
6
|
+
* - Allows parsing JavaScript files even if they are not allowed by TS config.
|
|
7
|
+
*
|
|
8
|
+
* @since v0.31.0
|
|
9
|
+
*/
|
|
10
|
+
export declare function languageOptions(): Linter.LanguageOptions;
|
|
11
|
+
/**
|
|
12
|
+
* Creates ESLint `languageOptions` object for JavaScript files.
|
|
13
|
+
*
|
|
14
|
+
* @since v0.31.0
|
|
15
|
+
*/
|
|
16
|
+
export declare function javascriptLanguageOptions(): Linter.LanguageOptions;
|
|
17
|
+
/**
|
|
18
|
+
* Creates ESLint `languageOptions` object for TypeScript files.
|
|
19
|
+
*
|
|
20
|
+
* - Uses TypeScript ESLint parser.
|
|
21
|
+
* - Does not allow JavaScript files.
|
|
22
|
+
*
|
|
23
|
+
* @since v0.31.0
|
|
24
|
+
*/
|
|
25
|
+
export declare function typescriptLanguageOptions(): Linter.LanguageOptions;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { parser as typescriptEslintParser } from 'typescript-eslint';
|
|
2
|
+
export function languageOptions() {
|
|
3
|
+
return {
|
|
4
|
+
sourceType: 'module',
|
|
5
|
+
ecmaVersion: 'latest',
|
|
6
|
+
parser: typescriptEslintParser,
|
|
7
|
+
parserOptions: {
|
|
8
|
+
ecmaFeatures: {
|
|
9
|
+
globalReturn: false,
|
|
10
|
+
impliedStrict: true
|
|
11
|
+
},
|
|
12
|
+
projectService: {
|
|
13
|
+
allowDefaultProject: ['?(.)*.?(m|c)js']
|
|
14
|
+
},
|
|
15
|
+
warnOnUnsupportedTypeScriptVersion: true
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export function javascriptLanguageOptions() {
|
|
20
|
+
return {
|
|
21
|
+
sourceType: 'module',
|
|
22
|
+
ecmaVersion: 'latest',
|
|
23
|
+
parserOptions: {
|
|
24
|
+
ecmaFeatures: {
|
|
25
|
+
globalReturn: false,
|
|
26
|
+
impliedStrict: true
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export function typescriptLanguageOptions() {
|
|
32
|
+
return {
|
|
33
|
+
sourceType: 'module',
|
|
34
|
+
ecmaVersion: 'latest',
|
|
35
|
+
parser: typescriptEslintParser,
|
|
36
|
+
parserOptions: {
|
|
37
|
+
ecmaFeatures: {
|
|
38
|
+
globalReturn: false,
|
|
39
|
+
impliedStrict: true
|
|
40
|
+
},
|
|
41
|
+
projectService: true,
|
|
42
|
+
warnOnUnsupportedTypeScriptVersion: true
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Linter } from 'eslint';
|
|
2
|
+
/**
|
|
3
|
+
* An ESLint flat config or a function that returns one.
|
|
4
|
+
*
|
|
5
|
+
* @since v0.31.0
|
|
6
|
+
*/
|
|
7
|
+
export type LinterConfig = Linter.Config | (() => Linter.Config);
|
|
8
|
+
/**
|
|
9
|
+
* A function to instantiate ESLint flat config.
|
|
10
|
+
*
|
|
11
|
+
* @since v0.31.0
|
|
12
|
+
*/
|
|
13
|
+
export declare function linterConfig(config: LinterConfig): Linter.Config;
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* A module does not have to be required directly by the package.json.
|
|
5
5
|
* The function returns true,
|
|
6
|
-
* even if it is installed as a dependency of another dependency but can be loaded by
|
|
6
|
+
* even if it is installed as a dependency of another dependency but can be loaded by Node.js.
|
|
7
|
+
*
|
|
8
|
+
* @protected
|
|
7
9
|
*/
|
|
8
10
|
export declare function hasNodeModule(module: string): boolean;
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* Returns an object with rule as a key and its config as a value,
|
|
3
|
+
* if a given rule belongs to an installed ESLint plugin.
|
|
4
4
|
*
|
|
5
5
|
* Otherwise, returns an empty object.
|
|
6
|
+
*
|
|
7
|
+
* @since v0.21.0
|
|
6
8
|
*/
|
|
7
9
|
export declare function optionalRule(rule: string, config: unknown): Record<string, unknown>;
|
|
8
10
|
/**
|
|
9
11
|
* Returns true if a given ESLint plugin exists.
|
|
12
|
+
*
|
|
13
|
+
* @since v0.21.0
|
|
10
14
|
*/
|
|
11
15
|
export declare function hasEslintPlugin(plugin: string): boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@perfective/eslint-config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.31.0",
|
|
4
4
|
"description": "ESLint shareable rules configuration",
|
|
5
5
|
"keywords": ["code quality", "code standard", "code style", "eslint", "eslint config", "lint", "perfective", "tslint", "tslint config", "typescript"],
|
|
6
6
|
"author": "Andrey Mikheychik <a.mikheychik@gmail.com>",
|
|
@@ -12,30 +12,29 @@
|
|
|
12
12
|
"type": "module",
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"peerDependencies": {
|
|
15
|
-
"@
|
|
15
|
+
"@eslint-community/eslint-plugin-eslint-comments": "^4.5.0",
|
|
16
16
|
"@stylistic/eslint-plugin": "^4.2.0",
|
|
17
17
|
"@stylistic/eslint-plugin-js": "^4.2.0",
|
|
18
18
|
"@stylistic/eslint-plugin-jsx": "^4.2.0",
|
|
19
19
|
"@stylistic/eslint-plugin-plus": "^4.2.0",
|
|
20
20
|
"@stylistic/eslint-plugin-ts": "^4.2.0",
|
|
21
|
-
"
|
|
22
|
-
"eslint": "^
|
|
23
|
-
"eslint-import-resolver-typescript": "^3.8.3",
|
|
21
|
+
"eslint": "^9.25.1",
|
|
22
|
+
"eslint-import-resolver-typescript": "^3.10.1",
|
|
24
23
|
"eslint-plugin-array-func": "^5.0.2",
|
|
25
|
-
"eslint-plugin-cypress": "^4.
|
|
26
|
-
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
24
|
+
"eslint-plugin-cypress": "^4.3.0",
|
|
27
25
|
"eslint-plugin-import": "^2.31.0",
|
|
28
26
|
"eslint-plugin-jest": "^28.11.0",
|
|
29
27
|
"eslint-plugin-jest-dom": "^5.5.0",
|
|
30
|
-
"eslint-plugin-jsdoc": "^50.6.
|
|
31
|
-
"eslint-plugin-n": "^17.
|
|
28
|
+
"eslint-plugin-jsdoc": "^50.6.11",
|
|
29
|
+
"eslint-plugin-n": "^17.17.0",
|
|
32
30
|
"eslint-plugin-prefer-arrow": "^1.2.3",
|
|
33
31
|
"eslint-plugin-promise": "^7.2.1",
|
|
32
|
+
"eslint-plugin-rxjs-x": "~0.7.2",
|
|
34
33
|
"eslint-plugin-security": "^3.0.1",
|
|
35
34
|
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
36
35
|
"eslint-plugin-testing-library": "^7.1.1",
|
|
37
|
-
"eslint-plugin-unicorn": "^
|
|
38
|
-
"typescript-eslint": "^8.
|
|
36
|
+
"eslint-plugin-unicorn": "^59.0.0",
|
|
37
|
+
"typescript-eslint": "^8.31.1"
|
|
39
38
|
},
|
|
40
39
|
"peerDependenciesMeta": {
|
|
41
40
|
"eslint-plugin-cypress": {
|
|
@@ -54,7 +53,7 @@
|
|
|
54
53
|
"optional": true
|
|
55
54
|
}
|
|
56
55
|
},
|
|
57
|
-
"main": "./index.
|
|
56
|
+
"main": "./index.cjs",
|
|
58
57
|
"module": "./index.js",
|
|
59
58
|
"types": "./index.d.ts",
|
|
60
59
|
"directories": {
|
|
@@ -64,43 +63,43 @@
|
|
|
64
63
|
"exports": {
|
|
65
64
|
".": {
|
|
66
65
|
"import": "./index.js",
|
|
67
|
-
"require": "./index.js",
|
|
68
66
|
"types": "./index.d.ts"
|
|
69
67
|
},
|
|
70
|
-
"./config": {
|
|
71
|
-
"import": "./config.js",
|
|
72
|
-
"require": "./config.js",
|
|
73
|
-
"types": "./config.d.ts"
|
|
74
|
-
},
|
|
75
|
-
"./rules": {
|
|
76
|
-
"import": "./rules.js",
|
|
77
|
-
"require": "./rules.js",
|
|
78
|
-
"types": "./rules.d.ts"
|
|
79
|
-
},
|
|
80
68
|
"./cypress": {
|
|
81
|
-
"import": "./cypress.js",
|
|
82
|
-
"
|
|
83
|
-
|
|
69
|
+
"import": "./config/cypress/index.js",
|
|
70
|
+
"types": "./config/cypress/index.d.ts"
|
|
71
|
+
},
|
|
72
|
+
"./import": {
|
|
73
|
+
"import": "./config/import/index.js",
|
|
74
|
+
"types": "./config/import/index.d.ts"
|
|
84
75
|
},
|
|
85
76
|
"./jest": {
|
|
86
|
-
"import": "./jest.js",
|
|
87
|
-
"
|
|
88
|
-
"types": "./jest.d.ts"
|
|
77
|
+
"import": "./config/jest/index.js",
|
|
78
|
+
"types": "./config/jest/index.d.ts"
|
|
89
79
|
},
|
|
90
80
|
"./jest-dom": {
|
|
91
|
-
"import": "./jest-dom.js",
|
|
92
|
-
"
|
|
93
|
-
"types": "./jest-dom.d.ts"
|
|
81
|
+
"import": "./config/jest-dom/index.js",
|
|
82
|
+
"types": "./config/jest-dom/index.d.ts"
|
|
94
83
|
},
|
|
95
84
|
"./rxjs": {
|
|
96
|
-
"import": "./rxjs.js",
|
|
97
|
-
"
|
|
98
|
-
|
|
85
|
+
"import": "./config/rxjs/index.js",
|
|
86
|
+
"types": "./config/rxjs/index.d.ts"
|
|
87
|
+
},
|
|
88
|
+
"./simple-import-sort": {
|
|
89
|
+
"import": "./config/simple-import-sort/index.js",
|
|
90
|
+
"types": "./config/simple-import-sort/index.d.ts"
|
|
99
91
|
},
|
|
100
92
|
"./testing-library": {
|
|
101
|
-
"import": "./testing-library.js",
|
|
102
|
-
"
|
|
103
|
-
|
|
93
|
+
"import": "./config/testing-library/index.js",
|
|
94
|
+
"types": "./config/testing-library/index.d.ts"
|
|
95
|
+
},
|
|
96
|
+
"./typescript-eslint": {
|
|
97
|
+
"import": "./config/typescript-eslint/index.js",
|
|
98
|
+
"types": "./config/typescript-eslint/index.d.ts"
|
|
99
|
+
},
|
|
100
|
+
"./unicorn": {
|
|
101
|
+
"import": "./config/unicorn/index.js",
|
|
102
|
+
"types": "./config/unicorn/index.d.ts"
|
|
104
103
|
}
|
|
105
104
|
},
|
|
106
105
|
"scripts": {}
|
package/config.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { hasEslintPlugin, optionalRule, } from './config/plugin';
|
package/config.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { hasEslintPlugin, optionalRule } from "./config/plugin.js";
|
package/cypress.d.ts
DELETED
package/cypress.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { parser } from 'typescript-eslint';
|
|
2
|
-
import { cypressOptionalConfig } from "./rules/cypress/index.js";
|
|
3
|
-
import { cypressImportNoExtraneousDependencies } from "./rules/import/rules/no-extraneous-dependencies.js";
|
|
4
|
-
export function cypressConfig(files = ['cypress/**/*.[jt]s']) {
|
|
5
|
-
return {
|
|
6
|
-
files,
|
|
7
|
-
languageOptions: Object.assign({
|
|
8
|
-
sourceType: 'module',
|
|
9
|
-
ecmaVersion: 'latest',
|
|
10
|
-
parser,
|
|
11
|
-
parserOptions: {
|
|
12
|
-
ecmaFeatures: {
|
|
13
|
-
globalReturn: false,
|
|
14
|
-
impliedStrict: true
|
|
15
|
-
},
|
|
16
|
-
projectService: true,
|
|
17
|
-
warnOnUnsupportedTypeScriptVersion: true
|
|
18
|
-
}
|
|
19
|
-
}, cypressOptionalConfig.languageOptions),
|
|
20
|
-
plugins: Object.assign({}, cypressOptionalConfig.plugins),
|
|
21
|
-
rules: Object.assign(Object.assign({}, cypressOptionalConfig.rules), {
|
|
22
|
-
'init-declarations': 'off',
|
|
23
|
-
'@typescript-eslint/init-declarations': 'off',
|
|
24
|
-
'import/no-extraneous-dependencies': ['error', cypressImportNoExtraneousDependencies()],
|
|
25
|
-
'max-nested-callbacks': ['error', 4],
|
|
26
|
-
'new-cap': ['error', {
|
|
27
|
-
capIsNewExceptions: ['Given', 'When', 'Then', 'And', 'But', 'Before', 'After']
|
|
28
|
-
}]
|
|
29
|
-
})
|
|
30
|
-
};
|
|
31
|
-
}
|
package/jest-dom.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function jestDomConfig(files?: string[]): Record<string, unknown>;
|
package/jest-dom.js
DELETED
package/jest.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Configuration for the Jest plugin.
|
|
3
|
-
*
|
|
4
|
-
* @param files - A list of globs with the Jest test files.
|
|
5
|
-
* Default value is extensions supported by Jest (/\.(spec|test)\.[jt]sx?$/).
|
|
6
|
-
*/
|
|
7
|
-
export declare function jestConfig(files?: string[]): Record<string, unknown>;
|
package/jest.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { jestImportNoExtraneousDependencies } from "./rules/import/rules/no-extraneous-dependencies.js";
|
|
2
|
-
import { jestConfig as jestPluginConfig } from "./rules/jest/index.js";
|
|
3
|
-
export function jestConfig(files = ['**/*.@(spec|test).[jt]s?(x)']) {
|
|
4
|
-
return {
|
|
5
|
-
files,
|
|
6
|
-
plugins: jestPluginConfig.plugins,
|
|
7
|
-
rules: Object.assign(Object.assign({}, jestPluginConfig.rules), {
|
|
8
|
-
'@typescript-eslint/ban-ts-comment': ['error', {
|
|
9
|
-
'ts-expect-error': 'allow-with-description',
|
|
10
|
-
'ts-ignore': true,
|
|
11
|
-
'ts-nocheck': true,
|
|
12
|
-
'ts-check': false
|
|
13
|
-
}],
|
|
14
|
-
'@typescript-eslint/init-declarations': 'off',
|
|
15
|
-
'@typescript-eslint/unbound-method': 'off',
|
|
16
|
-
'import/no-extraneous-dependencies': ['error', jestImportNoExtraneousDependencies()],
|
|
17
|
-
'import/no-unassigned-import': ['error', {
|
|
18
|
-
allow: ['@testing-library/jest-dom', '@testing-library/jest-dom/extend-expect']
|
|
19
|
-
}],
|
|
20
|
-
'max-nested-callbacks': ['error', 6],
|
|
21
|
-
'n/no-unpublished-import': ['error', {
|
|
22
|
-
allowModules: ['@jest/globals']
|
|
23
|
-
}],
|
|
24
|
-
'prefer-arrow/prefer-arrow-functions': 'off',
|
|
25
|
-
'promise/always-return': 'off',
|
|
26
|
-
'@smarttools/rxjs/no-topromise': 'off'
|
|
27
|
-
})
|
|
28
|
-
};
|
|
29
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export declare const arrayFuncConfig: {
|
|
2
|
-
plugins: {
|
|
3
|
-
'array-func': import("@typescript-eslint/utils/dist/ts-eslint").FlatConfig.Plugin;
|
|
4
|
-
};
|
|
5
|
-
rules: {
|
|
6
|
-
'array-func/from-map': string;
|
|
7
|
-
'array-func/no-unnecessary-this-arg': string;
|
|
8
|
-
'array-func/prefer-array-from': string;
|
|
9
|
-
'array-func/avoid-reverse': string;
|
|
10
|
-
'array-func/prefer-flat-map': string;
|
|
11
|
-
'array-func/prefer-flat': string;
|
|
12
|
-
};
|
|
13
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import eslintPluginArrayFunc from 'eslint-plugin-array-func';
|
|
2
|
-
export const arrayFuncConfig = {
|
|
3
|
-
plugins: {
|
|
4
|
-
'array-func': eslintPluginArrayFunc
|
|
5
|
-
},
|
|
6
|
-
rules: {
|
|
7
|
-
'array-func/from-map': 'warn',
|
|
8
|
-
'array-func/no-unnecessary-this-arg': 'error',
|
|
9
|
-
'array-func/prefer-array-from': 'warn',
|
|
10
|
-
'array-func/avoid-reverse': 'warn',
|
|
11
|
-
'array-func/prefer-flat-map': 'off',
|
|
12
|
-
'array-func/prefer-flat': 'off'
|
|
13
|
-
}
|
|
14
|
-
};
|
package/rules/cypress/index.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export declare const cypressOptionalConfig: {
|
|
2
|
-
plugins: {
|
|
3
|
-
cypress: import("@typescript-eslint/utils/dist/ts-eslint").FlatConfig.Plugin & {
|
|
4
|
-
configs: {
|
|
5
|
-
globals: {
|
|
6
|
-
languageOptions: {
|
|
7
|
-
globals: import("@typescript-eslint/utils/dist/ts-eslint").TSESLint.FlatConfig.GlobalsConfig;
|
|
8
|
-
};
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
languageOptions: {
|
|
14
|
-
globals: import("@typescript-eslint/utils/dist/ts-eslint").SharedConfig.GlobalsConfig;
|
|
15
|
-
};
|
|
16
|
-
rules: {
|
|
17
|
-
'cypress/assertion-before-screenshot': string;
|
|
18
|
-
'cypress/no-assigning-return-values': string;
|
|
19
|
-
'cypress/no-async-before': string;
|
|
20
|
-
'cypress/no-async-tests': string;
|
|
21
|
-
'cypress/no-debug': string;
|
|
22
|
-
'cypress/no-force': string;
|
|
23
|
-
'cypress/no-pause': string;
|
|
24
|
-
'cypress/no-unnecessary-waiting': string;
|
|
25
|
-
'cypress/no-xpath': string;
|
|
26
|
-
'cypress/require-data-selectors': string;
|
|
27
|
-
'cypress/unsafe-to-chain-command': string;
|
|
28
|
-
};
|
|
29
|
-
};
|
package/rules/cypress/index.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
var _a;
|
|
2
|
-
import eslintPluginCypress from 'eslint-plugin-cypress/flat';
|
|
3
|
-
export const cypressOptionalConfig = {
|
|
4
|
-
plugins: {
|
|
5
|
-
cypress: eslintPluginCypress
|
|
6
|
-
},
|
|
7
|
-
languageOptions: {
|
|
8
|
-
globals: (_a = eslintPluginCypress.configs.globals.languageOptions) === null || _a === void 0 ? void 0 : _a.globals
|
|
9
|
-
},
|
|
10
|
-
rules: {
|
|
11
|
-
'cypress/assertion-before-screenshot': 'error',
|
|
12
|
-
'cypress/no-assigning-return-values': 'error',
|
|
13
|
-
'cypress/no-async-before': 'error',
|
|
14
|
-
'cypress/no-async-tests': 'error',
|
|
15
|
-
'cypress/no-debug': 'error',
|
|
16
|
-
'cypress/no-force': 'error',
|
|
17
|
-
'cypress/no-pause': 'error',
|
|
18
|
-
'cypress/no-unnecessary-waiting': 'error',
|
|
19
|
-
'cypress/no-xpath': 'error',
|
|
20
|
-
'cypress/require-data-selectors': 'error',
|
|
21
|
-
'cypress/unsafe-to-chain-command': 'error'
|
|
22
|
-
}
|
|
23
|
-
};
|