@fullstacksjs/eslint-config 11.1.17 → 11.1.19
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.md +17 -1
- package/cjs/index.js +114 -0
- package/cjs/modules/base.js +213 -0
- package/cjs/modules/cypress.js +30 -0
- package/cjs/modules/functional.js +27 -0
- package/cjs/modules/ignore.js +17 -0
- package/cjs/modules/imports.js +112 -0
- package/cjs/modules/jest.js +82 -0
- package/cjs/modules/next.js +40 -0
- package/cjs/modules/node.js +68 -0
- package/cjs/modules/perfectionist.js +41 -0
- package/cjs/modules/playwright.js +26 -0
- package/cjs/modules/prettier.js +96 -0
- package/cjs/modules/promise.js +34 -0
- package/cjs/modules/react.js +123 -0
- package/cjs/modules/storybook.js +39 -0
- package/cjs/modules/tailwind.js +26 -0
- package/cjs/modules/tests.js +54 -0
- package/cjs/modules/typescript.js +276 -0
- package/cjs/modules/vitest.js +91 -0
- package/cjs/option.d.ts +25 -0
- package/cjs/utils/conditions.js +25 -0
- package/cjs/utils/globs.js +37 -0
- package/cjs/utils/naming-convention.js +63 -0
- package/package.json +13 -4
- package/src/index.js +53 -25
- package/src/modules/ignore.js +12 -0
- package/src/option.d.ts +3 -1
- package/src/utils/compose.js +0 -12
package/README.md
CHANGED
|
@@ -20,12 +20,22 @@ $ npm install --save-dev @fullstacksjs/eslint-config eslint prettier
|
|
|
20
20
|
|
|
21
21
|
To use the configuration all you need is exporting generated config by `init` function. The configuration reads the metadata from your root `package.json` file and automatically adds the rules and plugins that are needed.
|
|
22
22
|
|
|
23
|
+
### ESM
|
|
24
|
+
|
|
23
25
|
```js
|
|
24
26
|
import { init } from '@fullstacksjs/eslint-config';
|
|
25
27
|
|
|
26
28
|
export default init();
|
|
27
29
|
```
|
|
28
30
|
|
|
31
|
+
### CJS
|
|
32
|
+
|
|
33
|
+
```js
|
|
34
|
+
const { init } = require('@fullstacksjs/eslint-config');
|
|
35
|
+
|
|
36
|
+
module.exports = init();
|
|
37
|
+
```
|
|
38
|
+
|
|
29
39
|
## Modules API
|
|
30
40
|
|
|
31
41
|
You can fine tune module detection by overriding it, `init` function accepts options as its first argument to control enabled modules.
|
|
@@ -70,7 +80,13 @@ import { init } from '@fullstacksjs/eslint-config';
|
|
|
70
80
|
export default init(
|
|
71
81
|
{
|
|
72
82
|
typescript: true,
|
|
73
|
-
|
|
83
|
+
// You can pass extends here
|
|
84
|
+
rules {
|
|
85
|
+
'no-console': 'error'
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
// And any number of extra configurations
|
|
89
|
+
{
|
|
74
90
|
files: ['**/*.ts'],
|
|
75
91
|
rules: {},
|
|
76
92
|
}, {
|
package/cjs/index.js
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.init = init;
|
|
7
|
+
var _deepmerge = _interopRequireDefault(require("deepmerge"));
|
|
8
|
+
var _localPkg = require("local-pkg");
|
|
9
|
+
var _base = _interopRequireDefault(require("./modules/base.js"));
|
|
10
|
+
var _cypress = _interopRequireDefault(require("./modules/cypress.js"));
|
|
11
|
+
var _functional = _interopRequireDefault(require("./modules/functional.js"));
|
|
12
|
+
var _ignore = _interopRequireDefault(require("./modules/ignore.js"));
|
|
13
|
+
var _imports = _interopRequireDefault(require("./modules/imports.js"));
|
|
14
|
+
var _jest = _interopRequireDefault(require("./modules/jest.js"));
|
|
15
|
+
var _next = _interopRequireDefault(require("./modules/next.js"));
|
|
16
|
+
var _node = _interopRequireDefault(require("./modules/node.js"));
|
|
17
|
+
var _perfectionist = _interopRequireDefault(require("./modules/perfectionist.js"));
|
|
18
|
+
var _playwright = _interopRequireDefault(require("./modules/playwright.js"));
|
|
19
|
+
var _prettier = _interopRequireDefault(require("./modules/prettier.js"));
|
|
20
|
+
var _react = _interopRequireDefault(require("./modules/react.js"));
|
|
21
|
+
var _storybook = _interopRequireDefault(require("./modules/storybook.js"));
|
|
22
|
+
var _tailwind = _interopRequireDefault(require("./modules/tailwind.js"));
|
|
23
|
+
var _tests = _interopRequireDefault(require("./modules/tests.js"));
|
|
24
|
+
var _typescript = _interopRequireDefault(require("./modules/typescript.js"));
|
|
25
|
+
var _vitest = _interopRequireDefault(require("./modules/vitest.js"));
|
|
26
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
27
|
+
const testPackages = ['jest', 'vitest', 'cypress', 'playwright'];
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @typedef {import('eslint').Linter.Config} Config
|
|
31
|
+
* @typedef {import('./option.d.ts').Options} Options
|
|
32
|
+
* /
|
|
33
|
+
|
|
34
|
+
/** @type {Options} */
|
|
35
|
+
const defaultOptions = {
|
|
36
|
+
cypress: (0, _localPkg.isPackageExists)('cypress'),
|
|
37
|
+
disableExpensiveRules: false,
|
|
38
|
+
esm: false,
|
|
39
|
+
fp: true,
|
|
40
|
+
ignores: [],
|
|
41
|
+
import: {},
|
|
42
|
+
jest: (0, _localPkg.isPackageExists)('jest'),
|
|
43
|
+
next: (0, _localPkg.isPackageExists)('next'),
|
|
44
|
+
node: false,
|
|
45
|
+
sort: true,
|
|
46
|
+
playwright: (0, _localPkg.isPackageExists)('playwright'),
|
|
47
|
+
prettier: (0, _localPkg.isPackageExists)('prettier'),
|
|
48
|
+
react: (0, _localPkg.isPackageExists)('react'),
|
|
49
|
+
storybook: (0, _localPkg.isPackageExists)('storybook'),
|
|
50
|
+
strict: false,
|
|
51
|
+
tailwind: (0, _localPkg.isPackageExists)('tailwindcss'),
|
|
52
|
+
test: testPackages.some(p => (0, _localPkg.isPackageExists)(p)),
|
|
53
|
+
typescript: (0, _localPkg.isPackageExists)('typescript') ? {
|
|
54
|
+
projects: true
|
|
55
|
+
} : false,
|
|
56
|
+
vitest: (0, _localPkg.isPackageExists)('vitest')
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Initialize eslint config
|
|
61
|
+
* @param {Options} initOptions
|
|
62
|
+
* @param {...Config} extend
|
|
63
|
+
* @returns {Config[]}
|
|
64
|
+
*/
|
|
65
|
+
function init(initOptions = {}, ...extend) {
|
|
66
|
+
const options = (0, _deepmerge.default)(defaultOptions, initOptions);
|
|
67
|
+
if (options.typescript === true) {
|
|
68
|
+
options.typescript = {};
|
|
69
|
+
}
|
|
70
|
+
if (options.import === true) {
|
|
71
|
+
options.import = {};
|
|
72
|
+
}
|
|
73
|
+
const {
|
|
74
|
+
sort: enableSort,
|
|
75
|
+
cypress: enableCypress,
|
|
76
|
+
disableExpensiveRules,
|
|
77
|
+
esm: enableEsm,
|
|
78
|
+
fp: enableFp,
|
|
79
|
+
ignores: enableIgnores,
|
|
80
|
+
import: enableImport,
|
|
81
|
+
jest: enableJest,
|
|
82
|
+
next: enableNext,
|
|
83
|
+
node: enableNode,
|
|
84
|
+
playwright: enablePlaywright,
|
|
85
|
+
prettier: enablePrettier,
|
|
86
|
+
react: enableReact,
|
|
87
|
+
storybook: enableStorybook,
|
|
88
|
+
strict: enableStrict,
|
|
89
|
+
tailwind: enableTailwind,
|
|
90
|
+
test: enableTest,
|
|
91
|
+
typescript: enableTypescript,
|
|
92
|
+
vitest: enableVitest,
|
|
93
|
+
...eslintOptions
|
|
94
|
+
} = options;
|
|
95
|
+
const rules = [(0, _ignore.default)(options), (0, _base.default)(options)];
|
|
96
|
+
if (enableFp) rules.push((0, _functional.default)(options));
|
|
97
|
+
if (enableSort) rules.push((0, _perfectionist.default)(options));
|
|
98
|
+
if (enableImport) rules.push((0, _imports.default)(options));
|
|
99
|
+
if (enableTailwind) rules.push((0, _tailwind.default)(options));
|
|
100
|
+
if (enableTest) rules.push((0, _tests.default)(options));
|
|
101
|
+
if (enableNode) rules.push((0, _node.default)(options));
|
|
102
|
+
if (enableJest) rules.push((0, _jest.default)(options));
|
|
103
|
+
if (enableVitest) rules.push((0, _vitest.default)(options));
|
|
104
|
+
if (enableCypress) rules.push((0, _cypress.default)(options));
|
|
105
|
+
if (enableReact) rules.push((0, _react.default)(options));
|
|
106
|
+
if (enableStorybook) rules.push((0, _storybook.default)(options));
|
|
107
|
+
if (enableTypescript) rules.push((0, _typescript.default)(options));
|
|
108
|
+
if (enablePlaywright) rules.push((0, _playwright.default)(options));
|
|
109
|
+
if (enableNext && enableNext) rules.push((0, _next.default)(options));
|
|
110
|
+
if (enablePrettier) rules.push((0, _prettier.default)(options));
|
|
111
|
+
if (Object.keys(eslintOptions).length > 0) rules.push(eslintOptions);
|
|
112
|
+
if (extend) Array.prototype.push.apply(rules, extend);
|
|
113
|
+
return rules;
|
|
114
|
+
}
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _globals = _interopRequireDefault(require("globals"));
|
|
8
|
+
var _conditions = require("../utils/conditions.js");
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
/**
|
|
11
|
+
* @param { import('../option.d.ts').Options } options
|
|
12
|
+
* @return { import('eslint').Linter.Config }
|
|
13
|
+
*/
|
|
14
|
+
function base(options = {}) {
|
|
15
|
+
return {
|
|
16
|
+
languageOptions: {
|
|
17
|
+
ecmaVersion: 'latest',
|
|
18
|
+
sourceType: 'module',
|
|
19
|
+
globals: {
|
|
20
|
+
..._globals.default.browser,
|
|
21
|
+
..._globals.default.node,
|
|
22
|
+
..._globals.default.es2024
|
|
23
|
+
},
|
|
24
|
+
parserOptions: {
|
|
25
|
+
ecmaVersion: 'latest',
|
|
26
|
+
ecmaFeatures: {
|
|
27
|
+
jsx: true
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
rules: {
|
|
32
|
+
'accessor-pairs': 'error',
|
|
33
|
+
'array-callback-return': 'error',
|
|
34
|
+
'block-scoped-var': 'error',
|
|
35
|
+
'camelcase': ['warn', {
|
|
36
|
+
properties: 'always'
|
|
37
|
+
}],
|
|
38
|
+
'complexity': ['error', 14],
|
|
39
|
+
'constructor-super': 'error',
|
|
40
|
+
'default-case-last': 'error',
|
|
41
|
+
'default-case': 'error',
|
|
42
|
+
'default-param-last': 'warn',
|
|
43
|
+
'dot-notation': 'error',
|
|
44
|
+
'eqeqeq': ['error', 'smart'],
|
|
45
|
+
'for-direction': 'error',
|
|
46
|
+
'func-name-matching': 'error',
|
|
47
|
+
'func-names': 'error',
|
|
48
|
+
'getter-return': ['error', {
|
|
49
|
+
allowImplicit: true
|
|
50
|
+
}],
|
|
51
|
+
'guard-for-in': 'error',
|
|
52
|
+
'max-depth': ['error', 4],
|
|
53
|
+
'max-lines-per-function': ['error', 150],
|
|
54
|
+
'max-lines': ['error', {
|
|
55
|
+
max: 2500,
|
|
56
|
+
skipBlankLines: false,
|
|
57
|
+
skipComments: false
|
|
58
|
+
}],
|
|
59
|
+
'max-nested-callbacks': ['error', 7],
|
|
60
|
+
'max-params': ['error', 7],
|
|
61
|
+
'max-statements': ['error', 40],
|
|
62
|
+
'no-alert': 'error',
|
|
63
|
+
'no-array-constructor': 'error',
|
|
64
|
+
'no-await-in-loop': 'error',
|
|
65
|
+
'no-bitwise': 'error',
|
|
66
|
+
'no-caller': 'error',
|
|
67
|
+
'no-case-declarations': 'error',
|
|
68
|
+
'no-class-assign': 'error',
|
|
69
|
+
'no-compare-neg-zero': 'error',
|
|
70
|
+
'no-cond-assign': 'error',
|
|
71
|
+
'no-const-assign': 'error',
|
|
72
|
+
'no-constant-binary-expression': 'warn',
|
|
73
|
+
'no-constant-condition': 'error',
|
|
74
|
+
'no-constructor-return': 'error',
|
|
75
|
+
'no-control-regex': 'error',
|
|
76
|
+
'no-debugger': 'error',
|
|
77
|
+
'no-delete-var': 'error',
|
|
78
|
+
'no-div-regex': 'error',
|
|
79
|
+
'no-dupe-args': 'error',
|
|
80
|
+
'no-dupe-class-members': 'error',
|
|
81
|
+
'no-dupe-else-if': 'error',
|
|
82
|
+
'no-dupe-keys': 'error',
|
|
83
|
+
'no-duplicate-case': 'error',
|
|
84
|
+
'no-empty-character-class': 'error',
|
|
85
|
+
'no-empty-function': 'warn',
|
|
86
|
+
'no-empty-pattern': 'error',
|
|
87
|
+
'no-empty-static-block': 'warn',
|
|
88
|
+
'no-empty': 'error',
|
|
89
|
+
'no-eval': 'error',
|
|
90
|
+
'no-ex-assign': 'error',
|
|
91
|
+
'no-extend-native': 'error',
|
|
92
|
+
'no-extra-bind': 'error',
|
|
93
|
+
'no-extra-label': 'error',
|
|
94
|
+
'no-fallthrough': 'error',
|
|
95
|
+
'no-func-assign': 'error',
|
|
96
|
+
'no-global-assign': 'error',
|
|
97
|
+
'no-implicit-globals': 'error',
|
|
98
|
+
'no-implied-eval': 'error',
|
|
99
|
+
'no-import-assign': 'error',
|
|
100
|
+
'no-inner-declarations': 'error',
|
|
101
|
+
'no-invalid-regexp': 'error',
|
|
102
|
+
'no-invalid-this': 'warn',
|
|
103
|
+
'no-irregular-whitespace': 'error',
|
|
104
|
+
'no-iterator': 'error',
|
|
105
|
+
'no-label-var': 'error',
|
|
106
|
+
'no-labels': 'error',
|
|
107
|
+
'no-lone-blocks': 'error',
|
|
108
|
+
'no-lonely-if': 'error',
|
|
109
|
+
'no-loop-func': 'error',
|
|
110
|
+
'no-loss-of-precision': 'warn',
|
|
111
|
+
'no-multi-assign': 'error',
|
|
112
|
+
'no-multi-str': 'error',
|
|
113
|
+
'no-new-func': 'error',
|
|
114
|
+
'no-new-native-nonconstructor': 'error',
|
|
115
|
+
'no-new-wrappers': 'error',
|
|
116
|
+
'no-new': 'error',
|
|
117
|
+
'no-nonoctal-decimal-escape': 'error',
|
|
118
|
+
'no-obj-calls': 'error',
|
|
119
|
+
'no-object-constructor': 'error',
|
|
120
|
+
'no-octal-escape': 'error',
|
|
121
|
+
'no-octal': 'error',
|
|
122
|
+
'no-promise-executor-return': 'error',
|
|
123
|
+
'no-proto': 'error',
|
|
124
|
+
'no-redeclare': 'error',
|
|
125
|
+
'no-regex-spaces': 'error',
|
|
126
|
+
'no-restricted-globals': ['error', {
|
|
127
|
+
name: 'event',
|
|
128
|
+
message: 'Use local parameter instead.'
|
|
129
|
+
}],
|
|
130
|
+
'no-restricted-syntax': ['error', 'WithStatement'],
|
|
131
|
+
'no-return-assign': 'error',
|
|
132
|
+
'no-return-await': 'warn',
|
|
133
|
+
'no-script-url': 'error',
|
|
134
|
+
'no-self-assign': 'error',
|
|
135
|
+
'no-self-compare': 'error',
|
|
136
|
+
'no-sequences': 'error',
|
|
137
|
+
'no-setter-return': 'error',
|
|
138
|
+
'no-shadow-restricted-names': 'error',
|
|
139
|
+
'no-shadow': 'error',
|
|
140
|
+
'no-sparse-arrays': 'error',
|
|
141
|
+
'no-this-before-super': 'error',
|
|
142
|
+
'no-throw-literal': 'error',
|
|
143
|
+
'no-undef-init': 'error',
|
|
144
|
+
'no-undef': 'error',
|
|
145
|
+
'no-unexpected-multiline': 'error',
|
|
146
|
+
'no-unmodified-loop-condition': 'error',
|
|
147
|
+
'no-unneeded-ternary': 'error',
|
|
148
|
+
'no-unreachable-loop': 'error',
|
|
149
|
+
'no-unreachable': 'error',
|
|
150
|
+
'no-unsafe-finally': 'error',
|
|
151
|
+
'no-unsafe-negation': 'error',
|
|
152
|
+
'no-unsafe-optional-chaining': 'error',
|
|
153
|
+
'no-unused-labels': 'error',
|
|
154
|
+
'no-unused-private-class-members': 'warn',
|
|
155
|
+
'no-unused-vars': ['error', {
|
|
156
|
+
argsIgnorePattern: '^_',
|
|
157
|
+
varsIgnorePattern: '^ignore(d)?',
|
|
158
|
+
args: 'after-used',
|
|
159
|
+
ignoreRestSiblings: true
|
|
160
|
+
}],
|
|
161
|
+
'no-use-before-define': ['error', 'nofunc'],
|
|
162
|
+
'no-useless-backreference': 'error',
|
|
163
|
+
'no-useless-call': 'error',
|
|
164
|
+
'no-useless-catch': 'error',
|
|
165
|
+
'no-useless-computed-key': 'error',
|
|
166
|
+
'no-useless-concat': 'error',
|
|
167
|
+
'no-useless-constructor': 'error',
|
|
168
|
+
'no-useless-escape': 'error',
|
|
169
|
+
'no-useless-rename': 'error',
|
|
170
|
+
'no-useless-return': 'error',
|
|
171
|
+
'no-var': 'warn',
|
|
172
|
+
'no-warning-comments': ['warn', {
|
|
173
|
+
terms: ['fixme'],
|
|
174
|
+
location: 'anywhere'
|
|
175
|
+
}],
|
|
176
|
+
'object-shorthand': ['error', 'properties'],
|
|
177
|
+
'one-var': ['error', {
|
|
178
|
+
uninitialized: 'never',
|
|
179
|
+
initialized: 'never'
|
|
180
|
+
}],
|
|
181
|
+
'prefer-arrow-callback': ['warn', {
|
|
182
|
+
allowNamedFunctions: true,
|
|
183
|
+
allowUnboundThis: true
|
|
184
|
+
}],
|
|
185
|
+
'prefer-const': 'warn',
|
|
186
|
+
'prefer-exponentiation-operator': 'warn',
|
|
187
|
+
'prefer-numeric-literals': 'error',
|
|
188
|
+
'prefer-object-has-own': 'warn',
|
|
189
|
+
'prefer-rest-params': 'error',
|
|
190
|
+
'prefer-spread': 'error',
|
|
191
|
+
'prefer-template': 'error',
|
|
192
|
+
'radix': 'error',
|
|
193
|
+
'require-await': 'error',
|
|
194
|
+
'require-yield': 'error',
|
|
195
|
+
'strict': 'error',
|
|
196
|
+
'symbol-description': 'error',
|
|
197
|
+
'use-isnan': 'error',
|
|
198
|
+
'valid-typeof': 'error',
|
|
199
|
+
'vars-on-top': 'error',
|
|
200
|
+
'yoda': 'error',
|
|
201
|
+
'require-atomic-updates': 'warn',
|
|
202
|
+
'no-async-promise-executor': 'warn',
|
|
203
|
+
'grouped-accessor-pairs': 'warn',
|
|
204
|
+
'no-extra-boolean-cast': 'warn',
|
|
205
|
+
'no-param-reassign': 'warn',
|
|
206
|
+
'prefer-regex-literals': ['warn', {
|
|
207
|
+
disallowRedundantWrapping: true
|
|
208
|
+
}],
|
|
209
|
+
'no-console': (0, _conditions.strict)(options, 'warn')
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
module.exports = base;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _flat = _interopRequireDefault(require("eslint-plugin-cypress/flat"));
|
|
8
|
+
var _globs = require("../utils/globs.js");
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
/** @return { import('eslint').Linter.Config } */
|
|
11
|
+
function cypress() {
|
|
12
|
+
return {
|
|
13
|
+
files: _globs.globs.e2e,
|
|
14
|
+
plugins: {
|
|
15
|
+
cypress: _flat.default
|
|
16
|
+
},
|
|
17
|
+
rules: {
|
|
18
|
+
'cypress/assertion-before-screenshot': 'warn',
|
|
19
|
+
'cypress/no-assigning-return-values': 'error',
|
|
20
|
+
'cypress/no-async-tests': 'error',
|
|
21
|
+
'cypress/no-force': 'warn',
|
|
22
|
+
'cypress/no-pause': 'error',
|
|
23
|
+
'cypress/no-unnecessary-waiting': 'error',
|
|
24
|
+
'cypress/require-data-selectors': 'off',
|
|
25
|
+
'cypress/unsafe-to-chain-command': 'error',
|
|
26
|
+
'@typescript-eslint/no-namespace': 'off'
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
module.exports = cypress;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _eslintPluginFunctional = _interopRequireDefault(require("eslint-plugin-functional"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
/**
|
|
10
|
+
* @param { import('../option').Options } options
|
|
11
|
+
* @return { import('eslint').Linter.Config }
|
|
12
|
+
*/
|
|
13
|
+
function fp() {
|
|
14
|
+
return {
|
|
15
|
+
plugins: {
|
|
16
|
+
functional: _eslintPluginFunctional.default
|
|
17
|
+
},
|
|
18
|
+
rules: {
|
|
19
|
+
'functional/functional-parameters': 'off',
|
|
20
|
+
'functional/no-let': ['error', {
|
|
21
|
+
allowInForLoopInit: true
|
|
22
|
+
}],
|
|
23
|
+
'functional/no-loop-statements': 'error'
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
module.exports = fp;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _globs = require("../utils/globs.js");
|
|
8
|
+
/**
|
|
9
|
+
* @param { import('../option').Options } options
|
|
10
|
+
* @return { import('eslint').Linter.Config }
|
|
11
|
+
*/
|
|
12
|
+
function ignores(options = {}) {
|
|
13
|
+
return {
|
|
14
|
+
ignores: [..._globs.ignoreGlobs, ...(options.ignores ?? [])]
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
module.exports = ignores;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _eslintPluginImportX = _interopRequireDefault(require("eslint-plugin-import-x"));
|
|
8
|
+
var _conditions = require("../utils/conditions.js");
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
const tsExtensions = ['.ts', '.tsx', '.cts', '.mts', '.ctsx', '.mtsx'];
|
|
11
|
+
const jsExtensions = ['.mjs', '.js', '.jsx', '.cjs'];
|
|
12
|
+
const allExtensions = [...jsExtensions, ...tsExtensions];
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @param { import('../option.d.ts').Options } options
|
|
16
|
+
* @return { import('eslint').Linter.Config }
|
|
17
|
+
*/
|
|
18
|
+
function imports(options = {}) {
|
|
19
|
+
const isObject = typeof options.import === 'object';
|
|
20
|
+
const ignoreExtensions = {};
|
|
21
|
+
if (!options.esm) {
|
|
22
|
+
ignoreExtensions.js = 'never';
|
|
23
|
+
ignoreExtensions.jsx = 'never';
|
|
24
|
+
if (options.typescript) {
|
|
25
|
+
ignoreExtensions.ts = 'never';
|
|
26
|
+
ignoreExtensions.tsx = 'never';
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
const config = {
|
|
30
|
+
plugins: {
|
|
31
|
+
import: _eslintPluginImportX.default
|
|
32
|
+
},
|
|
33
|
+
settings: {
|
|
34
|
+
'import-x/extensions': jsExtensions,
|
|
35
|
+
'import-x/external-module-folders': ['node_modules', 'node_modules/@types'],
|
|
36
|
+
'import-x/ignore': ['node_modules', '\\.(scss|css|svg|json)$'],
|
|
37
|
+
...(0, _conditions.predicate)(options.typescript, {
|
|
38
|
+
'import-x/resolver': {
|
|
39
|
+
typescript: true
|
|
40
|
+
},
|
|
41
|
+
'import-x/parsers': {
|
|
42
|
+
'@typescript-eslint/parser': tsExtensions
|
|
43
|
+
},
|
|
44
|
+
'import-x/extensions': allExtensions
|
|
45
|
+
}),
|
|
46
|
+
...(0, _conditions.predicate)(isObject && 'internalRegExp' in options.import, {
|
|
47
|
+
'import-x/internal-regex': options.import.internalRegExp
|
|
48
|
+
}),
|
|
49
|
+
...(0, _conditions.predicate)(isObject && 'lifetime' in options.import, {
|
|
50
|
+
'import-x/cache': {
|
|
51
|
+
lifetime: options.import.lifetime
|
|
52
|
+
}
|
|
53
|
+
})
|
|
54
|
+
},
|
|
55
|
+
rules: {
|
|
56
|
+
'import/consistent-type-specifier-style': ['warn', 'prefer-top-level'],
|
|
57
|
+
'import/extensions': ['error', 'ignorePackages', ignoreExtensions],
|
|
58
|
+
'import/first': 'error',
|
|
59
|
+
'import/newline-after-import': 'warn',
|
|
60
|
+
'import/no-absolute-path': 'error',
|
|
61
|
+
'import/no-amd': 'error',
|
|
62
|
+
'import/no-duplicates': 'error',
|
|
63
|
+
'import/no-empty-named-blocks': 'error',
|
|
64
|
+
'import/no-extraneous-dependencies': ['error', {
|
|
65
|
+
devDependencies: true
|
|
66
|
+
}],
|
|
67
|
+
'import/no-mutable-exports': 'error',
|
|
68
|
+
'import/no-named-as-default': 'error',
|
|
69
|
+
'import/no-named-default': 'error',
|
|
70
|
+
'import/no-relative-packages': 'error',
|
|
71
|
+
'import/no-self-import': 'error',
|
|
72
|
+
'import/no-unresolved': ['error', {
|
|
73
|
+
caseSensitiveStrict: true
|
|
74
|
+
}],
|
|
75
|
+
'import/no-useless-path-segments': 'warn',
|
|
76
|
+
'import/no-webpack-loader-syntax': 'error',
|
|
77
|
+
'import/order': 'off',
|
|
78
|
+
...(0, _conditions.predicate)(!options.disableExpensiveRules, {
|
|
79
|
+
'import/default': 'error',
|
|
80
|
+
'import/export': 'error',
|
|
81
|
+
'import/named': 'error',
|
|
82
|
+
'import/namespace': 'error',
|
|
83
|
+
'import/no-cycle': ['error', {
|
|
84
|
+
maxDepth: Infinity
|
|
85
|
+
}],
|
|
86
|
+
'import/no-deprecated': 'warn',
|
|
87
|
+
'import/no-named-as-default-member': 'error'
|
|
88
|
+
}),
|
|
89
|
+
'import/dynamic-import-chunkname': 'off',
|
|
90
|
+
'import/exports-last': 'off',
|
|
91
|
+
'import/group-exports': 'off',
|
|
92
|
+
'import/max-dependencies': 'off',
|
|
93
|
+
'import/no-anonymous-default-export': 'off',
|
|
94
|
+
'import/no-commonjs': 'off',
|
|
95
|
+
'import/no-default-export': 'off',
|
|
96
|
+
'import/no-dynamic-require': 'off',
|
|
97
|
+
'import/no-import-module-exports': 'off',
|
|
98
|
+
'import/no-internal-modules': 'off',
|
|
99
|
+
'import/no-named-export': 'off',
|
|
100
|
+
'import/no-namespace': 'off',
|
|
101
|
+
'import/no-nodejs-modules': 'off',
|
|
102
|
+
'import/no-relative-parent-imports': 'off',
|
|
103
|
+
'import/no-restricted-paths': 'off',
|
|
104
|
+
'import/no-unassigned-import': 'off',
|
|
105
|
+
'import/no-unused-modules': 'off',
|
|
106
|
+
'import/prefer-default-export': 'off',
|
|
107
|
+
'import/unambiguous': 'off'
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
return config;
|
|
111
|
+
}
|
|
112
|
+
module.exports = imports;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _eslintPluginJest = _interopRequireDefault(require("eslint-plugin-jest"));
|
|
8
|
+
var _globs = require("../utils/globs.js");
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
/**
|
|
11
|
+
* @param { import('../option.d.ts').Options } options
|
|
12
|
+
* @return { import('eslint').Linter.Config } */
|
|
13
|
+
function jest() {
|
|
14
|
+
return {
|
|
15
|
+
files: _globs.globs.test,
|
|
16
|
+
plugins: {
|
|
17
|
+
jest: _eslintPluginJest.default
|
|
18
|
+
},
|
|
19
|
+
rules: {
|
|
20
|
+
'jest/consistent-test-it': 'off',
|
|
21
|
+
'jest/expect-expect': 'off',
|
|
22
|
+
'jest/lowercase-name': 'off',
|
|
23
|
+
'jest/max-nested-describe': ['error', {
|
|
24
|
+
max: 2
|
|
25
|
+
}],
|
|
26
|
+
'jest/no-alias-methods': 'error',
|
|
27
|
+
'jest/no-commented-out-tests': 'warn',
|
|
28
|
+
'jest/no-conditional-expect': 'error',
|
|
29
|
+
'jest/no-conditional-in-test': 'error',
|
|
30
|
+
'jest/no-confusing-set-timeout': 'warn',
|
|
31
|
+
'jest/no-done-callback': 'warn',
|
|
32
|
+
'jest/no-expect-resolves': 'off',
|
|
33
|
+
'jest/no-export': 'error',
|
|
34
|
+
'jest/no-hooks': 'off',
|
|
35
|
+
'jest/no-interpolation-in-snapshots': 'error',
|
|
36
|
+
'jest/no-jasmine-globals': 'off',
|
|
37
|
+
'jest/no-large-snapshots': ['warn', {
|
|
38
|
+
maxSize: 300
|
|
39
|
+
}],
|
|
40
|
+
'jest/no-mocks-import': 'error',
|
|
41
|
+
'jest/no-restricted-jest-methods': 'off',
|
|
42
|
+
'jest/no-restricted-matchers': 'error',
|
|
43
|
+
'jest/no-standalone-expect': 'off',
|
|
44
|
+
'jest/no-test-callback': 'off',
|
|
45
|
+
'jest/no-test-prefixes': 'error',
|
|
46
|
+
'jest/no-test-return-statement': 'off',
|
|
47
|
+
'jest/no-truthy-falsy': 'off',
|
|
48
|
+
'jest/prefer-called-with': 'error',
|
|
49
|
+
'jest/prefer-each': 'warn',
|
|
50
|
+
'jest/prefer-expect-assertions': 'off',
|
|
51
|
+
'jest/prefer-expect-resolves': 'warn',
|
|
52
|
+
'jest/prefer-hooks-on-top': 'error',
|
|
53
|
+
'jest/prefer-inline-snapshots': 'off',
|
|
54
|
+
'jest/prefer-lowercase-title': 'off',
|
|
55
|
+
'jest/prefer-mock-promise-shorthand': 'warn',
|
|
56
|
+
'jest/prefer-snapshot-hint': 'warn',
|
|
57
|
+
'jest/prefer-spy-on': 'off',
|
|
58
|
+
'jest/prefer-strict-equal': 'off',
|
|
59
|
+
'jest/prefer-to-be-null': 'off',
|
|
60
|
+
'jest/prefer-to-be-undefined': 'off',
|
|
61
|
+
'jest/prefer-to-be': 'warn',
|
|
62
|
+
'jest/prefer-to-contain': 'warn',
|
|
63
|
+
'jest/prefer-to-have-length': 'warn',
|
|
64
|
+
'jest/prefer-todo': 'warn',
|
|
65
|
+
'jest/require-hook': 'off',
|
|
66
|
+
'jest/require-to-throw-message': 'off',
|
|
67
|
+
'jest/require-top-level-describe': 'off',
|
|
68
|
+
'jest/valid-describe-callback': 'error',
|
|
69
|
+
'jest/valid-expect-in-promise': 'error',
|
|
70
|
+
'jest/valid-expect': 'error',
|
|
71
|
+
'jest/valid-title': 'warn',
|
|
72
|
+
'jest/no-deprecated-functions': 'error'
|
|
73
|
+
|
|
74
|
+
// ...predicate(options.typescript, {
|
|
75
|
+
// '@typescript-eslint/unbound-method': 'off',
|
|
76
|
+
// 'jest/unbound-method': 'error',
|
|
77
|
+
// 'jest/no-untyped-mock-factory': 'warn',
|
|
78
|
+
// }),
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
module.exports = jest;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _eslintPluginNext = _interopRequireDefault(require("@next/eslint-plugin-next"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
/** @type { import('eslint').Linter.Config } */
|
|
10
|
+
function next() {
|
|
11
|
+
return {
|
|
12
|
+
plugins: {
|
|
13
|
+
next: _eslintPluginNext.default
|
|
14
|
+
},
|
|
15
|
+
rules: {
|
|
16
|
+
'next/google-font-display': 'warn',
|
|
17
|
+
'next/google-font-preconnect': 'warn',
|
|
18
|
+
'next/inline-script-id': 'warn',
|
|
19
|
+
'next/next-script-for-ga': 'warn',
|
|
20
|
+
'next/no-assign-module-variable': 'warn',
|
|
21
|
+
'next/no-async-client-component': 'warn',
|
|
22
|
+
'next/no-before-interactive-script-outside-document': 'warn',
|
|
23
|
+
'next/no-css-tags': 'warn',
|
|
24
|
+
'next/no-document-import-in-page': 'warn',
|
|
25
|
+
// 'next/no-duplicate-head': 'warn',
|
|
26
|
+
'next/no-head-element': 'warn',
|
|
27
|
+
'next/no-head-import-in-document': 'warn',
|
|
28
|
+
'next/no-html-link-for-pages': 'warn',
|
|
29
|
+
'next/no-img-element': 'warn',
|
|
30
|
+
'next/no-page-custom-font': 'warn',
|
|
31
|
+
'next/no-script-component-in-head': 'warn',
|
|
32
|
+
'next/no-styled-jsx-in-document': 'warn',
|
|
33
|
+
'next/no-sync-scripts': 'warn',
|
|
34
|
+
'next/no-title-in-document-head': 'warn',
|
|
35
|
+
'next/no-typos': 'warn',
|
|
36
|
+
'next/no-unwanted-polyfillio': 'warn'
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
module.exports = next;
|