@fullstacksjs/eslint-config 13.1.0 → 13.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/README.md +2 -0
- package/cjs/index.d.ts +5 -0
- package/cjs/index.js +12 -1
- package/cjs/modules/base.js +3 -0
- package/cjs/modules/regex.js +94 -0
- package/package.json +2 -1
- package/src/index.d.ts +5 -0
- package/src/index.mjs +8 -0
- package/src/modules/base.mjs +1 -0
- package/src/modules/regex.mjs +87 -0
package/README.md
CHANGED
|
@@ -74,6 +74,7 @@ interface Options {
|
|
|
74
74
|
prettier?: boolean; // controls prettier plugin
|
|
75
75
|
disableExpensiveRules?: boolean; // controls expensive rules
|
|
76
76
|
gitignore?: false | string; // automatically ignore paths from .gitignore
|
|
77
|
+
regex?: boolean | {allowedCharacterRanges?: string[]} // controls regexp plugin
|
|
77
78
|
}
|
|
78
79
|
```
|
|
79
80
|
|
|
@@ -209,6 +210,7 @@ export default defineConfig({
|
|
|
209
210
|
* [eslint-plugin-better-tailwindcss](https://github.com/schoero/eslint-plugin-better-tailwindcss)
|
|
210
211
|
* [eslint-plugin-vitest](https://www.npmjs.com/package/eslint-plugin-vitest)
|
|
211
212
|
* [typescript-eslint](https://typescript-eslint.io/)
|
|
213
|
+
* [eslint-plugin-regexp](https://www.npmjs.com/package/eslint-plugin-regexp)
|
|
212
214
|
|
|
213
215
|
That's all. Feel free to use 💛
|
|
214
216
|
|
package/cjs/index.d.ts
CHANGED
|
@@ -109,6 +109,11 @@ export interface Options extends Linter.Config {
|
|
|
109
109
|
* @default './.gitignore'
|
|
110
110
|
*/
|
|
111
111
|
gitignore?: string | false;
|
|
112
|
+
/**
|
|
113
|
+
* Controls regex plugin.
|
|
114
|
+
* @default true
|
|
115
|
+
*/
|
|
116
|
+
regex?: boolean | { allowedCharacterRanges: string[] };
|
|
112
117
|
}
|
|
113
118
|
|
|
114
119
|
export declare function defineConfig(initOptions?: Options, ...extend: Linter.Config[]): Linter.Config[];
|
package/cjs/index.js
CHANGED
|
@@ -18,6 +18,7 @@ var _perfectionist = _interopRequireDefault(require("./modules/perfectionist.js"
|
|
|
18
18
|
var _playwright = _interopRequireDefault(require("./modules/playwright.js"));
|
|
19
19
|
var _prettier = _interopRequireDefault(require("./modules/prettier.js"));
|
|
20
20
|
var _react = _interopRequireDefault(require("./modules/react.js"));
|
|
21
|
+
var _regex = _interopRequireDefault(require("./modules/regex.js"));
|
|
21
22
|
var _storybook = _interopRequireDefault(require("./modules/storybook.js"));
|
|
22
23
|
var _stylistic = _interopRequireDefault(require("./modules/stylistic.js"));
|
|
23
24
|
var _tailwind = _interopRequireDefault(require("./modules/tailwind.js"));
|
|
@@ -54,7 +55,10 @@ const defaultOptions = {
|
|
|
54
55
|
typescript: (0, _localPkg.isPackageExists)('typescript') ? {
|
|
55
56
|
projectService: true
|
|
56
57
|
} : false,
|
|
57
|
-
vitest: (0, _localPkg.isPackageExists)('vitest')
|
|
58
|
+
vitest: (0, _localPkg.isPackageExists)('vitest'),
|
|
59
|
+
regex: {
|
|
60
|
+
allowedCharacterRanges: ['all']
|
|
61
|
+
}
|
|
58
62
|
};
|
|
59
63
|
|
|
60
64
|
/**
|
|
@@ -68,6 +72,11 @@ function defineConfig(initOptions = {}, ...extend) {
|
|
|
68
72
|
if (options.import === true) {
|
|
69
73
|
options.import = {};
|
|
70
74
|
}
|
|
75
|
+
if (options.regex === true) {
|
|
76
|
+
options.regex = {
|
|
77
|
+
allowedCharacterRanges: ['all']
|
|
78
|
+
};
|
|
79
|
+
}
|
|
71
80
|
const {
|
|
72
81
|
sort: enableSort,
|
|
73
82
|
cypress: enableCypress,
|
|
@@ -88,6 +97,7 @@ function defineConfig(initOptions = {}, ...extend) {
|
|
|
88
97
|
test: enableTest,
|
|
89
98
|
typescript: enableTypescript,
|
|
90
99
|
vitest: enableVitest,
|
|
100
|
+
regex: enableRegex,
|
|
91
101
|
...eslintOptions
|
|
92
102
|
} = options;
|
|
93
103
|
const rules = [(0, _ignore.default)(options), (0, _base.default)(options), (0, _stylistic.default)(options)];
|
|
@@ -105,6 +115,7 @@ function defineConfig(initOptions = {}, ...extend) {
|
|
|
105
115
|
if (enableTest) rules.push((0, _tests.default)(options));
|
|
106
116
|
if (enableCypress) rules.push((0, _cypress.default)(options));
|
|
107
117
|
if (enablePlaywright) rules.push((0, _playwright.default)(options));
|
|
118
|
+
if (enableRegex) rules.push((0, _regex.default)(options));
|
|
108
119
|
if (Object.keys(eslintOptions).length > 0) rules.push(eslintOptions);
|
|
109
120
|
if (extend) Array.prototype.push.apply(rules, extend);
|
|
110
121
|
return (0, _config.defineConfig)(rules);
|
package/cjs/modules/base.js
CHANGED
|
@@ -108,6 +108,9 @@ function base(options = {}) {
|
|
|
108
108
|
'no-lonely-if': 'error',
|
|
109
109
|
'no-loop-func': 'error',
|
|
110
110
|
'no-loss-of-precision': 'warn',
|
|
111
|
+
'no-misleading-character-class': ['error', {
|
|
112
|
+
allowEscape: true
|
|
113
|
+
}],
|
|
111
114
|
'no-multi-assign': 'error',
|
|
112
115
|
'no-multi-str': 'error',
|
|
113
116
|
'no-new-func': 'error',
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var plugin = _interopRequireWildcard(require("eslint-plugin-regexp"));
|
|
8
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
9
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
10
|
+
/**
|
|
11
|
+
* @param { import('../index.js').Options } options
|
|
12
|
+
* @return { Promise<import('eslint').Linter.Config> }
|
|
13
|
+
*/
|
|
14
|
+
function regex(options = {}) {
|
|
15
|
+
return {
|
|
16
|
+
plugins: {
|
|
17
|
+
regexp: plugin
|
|
18
|
+
},
|
|
19
|
+
settings: {
|
|
20
|
+
regexp: {
|
|
21
|
+
allowedCharacterRanges: options.regex.allowedCharacterRanges
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
rules: {
|
|
25
|
+
'regexp/confusing-quantifier': 'warn',
|
|
26
|
+
'regexp/control-character-escape': 'error',
|
|
27
|
+
'regexp/letter-case': 'warn',
|
|
28
|
+
'regexp/match-any': 'error',
|
|
29
|
+
'regexp/negation': 'error',
|
|
30
|
+
'regexp/no-contradiction-with-assertion': 'error',
|
|
31
|
+
'regexp/no-dupe-characters-character-class': 'error',
|
|
32
|
+
'regexp/no-dupe-disjunctions': 'error',
|
|
33
|
+
'regexp/no-empty-alternative': 'warn',
|
|
34
|
+
'regexp/no-empty-capturing-group': 'error',
|
|
35
|
+
'regexp/no-empty-character-class': 'error',
|
|
36
|
+
'regexp/no-empty-group': 'error',
|
|
37
|
+
'regexp/no-empty-lookarounds-assertion': 'error',
|
|
38
|
+
'regexp/no-empty-string-literal': 'error',
|
|
39
|
+
'regexp/no-escape-backspace': 'error',
|
|
40
|
+
'regexp/no-extra-lookaround-assertions': 'error',
|
|
41
|
+
'regexp/no-invalid-regexp': 'error',
|
|
42
|
+
'regexp/no-invisible-character': 'error',
|
|
43
|
+
'regexp/no-lazy-ends': 'warn',
|
|
44
|
+
'regexp/no-legacy-features': 'error',
|
|
45
|
+
'regexp/no-misleading-capturing-group': 'error',
|
|
46
|
+
'regexp/no-misleading-unicode-character': 'error',
|
|
47
|
+
'regexp/no-missing-g-flag': 'error',
|
|
48
|
+
'regexp/no-non-standard-flag': 'error',
|
|
49
|
+
'regexp/no-obscure-range': 'error',
|
|
50
|
+
'regexp/no-optional-assertion': 'error',
|
|
51
|
+
'regexp/no-potentially-useless-backreference': 'warn',
|
|
52
|
+
'regexp/no-super-linear-backtracking': 'error',
|
|
53
|
+
'regexp/no-trivially-nested-assertion': 'error',
|
|
54
|
+
'regexp/no-trivially-nested-quantifier': 'error',
|
|
55
|
+
'regexp/no-unused-capturing-group': 'error',
|
|
56
|
+
'regexp/no-useless-assertions': 'error',
|
|
57
|
+
'regexp/no-useless-backreference': 'error',
|
|
58
|
+
'regexp/no-useless-character-class': 'error',
|
|
59
|
+
'regexp/no-useless-dollar-replacements': 'error',
|
|
60
|
+
'regexp/no-useless-escape': 'error',
|
|
61
|
+
'regexp/no-useless-flag': 'warn',
|
|
62
|
+
'regexp/no-useless-lazy': 'error',
|
|
63
|
+
'regexp/no-useless-non-capturing-group': 'error',
|
|
64
|
+
'regexp/no-useless-quantifier': 'error',
|
|
65
|
+
'regexp/no-useless-range': 'error',
|
|
66
|
+
'regexp/no-useless-set-operand': 'error',
|
|
67
|
+
'regexp/no-useless-string-literal': 'error',
|
|
68
|
+
'regexp/no-useless-two-nums-quantifier': 'error',
|
|
69
|
+
'regexp/no-zero-quantifier': 'error',
|
|
70
|
+
'regexp/optimal-lookaround-quantifier': 'warn',
|
|
71
|
+
'regexp/optimal-quantifier-concatenation': 'error',
|
|
72
|
+
'regexp/prefer-character-class': 'error',
|
|
73
|
+
'regexp/prefer-d': 'error',
|
|
74
|
+
'regexp/prefer-plus-quantifier': 'error',
|
|
75
|
+
'regexp/prefer-predefined-assertion': 'error',
|
|
76
|
+
'regexp/prefer-question-quantifier': 'error',
|
|
77
|
+
'regexp/prefer-range': 'error',
|
|
78
|
+
'regexp/prefer-set-operation': 'error',
|
|
79
|
+
'regexp/prefer-star-quantifier': 'error',
|
|
80
|
+
'regexp/prefer-unicode-codepoint-escapes': 'error',
|
|
81
|
+
'regexp/prefer-w': 'error',
|
|
82
|
+
'regexp/simplify-set-operations': 'error',
|
|
83
|
+
'regexp/sort-alternatives': 'warn',
|
|
84
|
+
'regexp/sort-character-class-elements': 'warn',
|
|
85
|
+
'regexp/sort-flags': 'warn',
|
|
86
|
+
'regexp/strict': 'error',
|
|
87
|
+
'regexp/use-ignore-case': 'error',
|
|
88
|
+
'no-invalid-regexp': 'off',
|
|
89
|
+
'no-useless-backreference': 'off',
|
|
90
|
+
'no-empty-character-class': 'off'
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
module.exports = regex;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fullstacksjs/eslint-config",
|
|
3
|
-
"version": "13.1
|
|
3
|
+
"version": "13.2.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "fullstacks <fullstacksjs@gmail.com>",
|
|
6
6
|
"description": "fullstacks eslint config",
|
|
@@ -52,6 +52,7 @@
|
|
|
52
52
|
"eslint-plugin-prettier": "5.5.1",
|
|
53
53
|
"eslint-plugin-promise": "7.2.1",
|
|
54
54
|
"eslint-plugin-react-hooks": "5.2.0",
|
|
55
|
+
"eslint-plugin-regexp": "2.9.0",
|
|
55
56
|
"eslint-plugin-storybook": "0.12.0",
|
|
56
57
|
"eslint-plugin-vitest": "0.5.4",
|
|
57
58
|
"globals": "16.3.0",
|
package/src/index.d.ts
CHANGED
|
@@ -109,6 +109,11 @@ export interface Options extends Linter.Config {
|
|
|
109
109
|
* @default './.gitignore'
|
|
110
110
|
*/
|
|
111
111
|
gitignore?: string | false;
|
|
112
|
+
/**
|
|
113
|
+
* Controls regex plugin.
|
|
114
|
+
* @default true
|
|
115
|
+
*/
|
|
116
|
+
regex?: boolean | { allowedCharacterRanges: string[] };
|
|
112
117
|
}
|
|
113
118
|
|
|
114
119
|
export declare function defineConfig(initOptions?: Options, ...extend: Linter.Config[]): Linter.Config[];
|
package/src/index.mjs
CHANGED
|
@@ -13,6 +13,7 @@ import perfectionist from './modules/perfectionist.mjs';
|
|
|
13
13
|
import playwright from './modules/playwright.mjs';
|
|
14
14
|
import prettier from './modules/prettier.mjs';
|
|
15
15
|
import react from './modules/react.mjs';
|
|
16
|
+
import regex from './modules/regex.mjs';
|
|
16
17
|
import storybook from './modules/storybook.mjs';
|
|
17
18
|
import stylistic from './modules/stylistic.mjs';
|
|
18
19
|
import tailwind from './modules/tailwind.mjs';
|
|
@@ -48,6 +49,7 @@ const defaultOptions = {
|
|
|
48
49
|
test: testPackages.some(p => isPackageExists(p)),
|
|
49
50
|
typescript: isPackageExists('typescript') ? { projectService: true } : false,
|
|
50
51
|
vitest: isPackageExists('vitest'),
|
|
52
|
+
regex: { allowedCharacterRanges: ['all'] },
|
|
51
53
|
};
|
|
52
54
|
|
|
53
55
|
/**
|
|
@@ -63,6 +65,10 @@ export function defineConfig(initOptions = {}, ...extend) {
|
|
|
63
65
|
options.import = {};
|
|
64
66
|
}
|
|
65
67
|
|
|
68
|
+
if (options.regex === true) {
|
|
69
|
+
options.regex = { allowedCharacterRanges: ['all'] };
|
|
70
|
+
}
|
|
71
|
+
|
|
66
72
|
const {
|
|
67
73
|
sort: enableSort,
|
|
68
74
|
cypress: enableCypress,
|
|
@@ -83,6 +89,7 @@ export function defineConfig(initOptions = {}, ...extend) {
|
|
|
83
89
|
test: enableTest,
|
|
84
90
|
typescript: enableTypescript,
|
|
85
91
|
vitest: enableVitest,
|
|
92
|
+
regex: enableRegex,
|
|
86
93
|
...eslintOptions
|
|
87
94
|
} = options;
|
|
88
95
|
|
|
@@ -102,6 +109,7 @@ export function defineConfig(initOptions = {}, ...extend) {
|
|
|
102
109
|
if (enableTest) rules.push(tests(options));
|
|
103
110
|
if (enableCypress) rules.push(cypress(options));
|
|
104
111
|
if (enablePlaywright) rules.push(playwright(options));
|
|
112
|
+
if (enableRegex) rules.push(regex(options));
|
|
105
113
|
|
|
106
114
|
if (Object.keys(eslintOptions).length > 0) rules.push(eslintOptions);
|
|
107
115
|
if (extend) Array.prototype.push.apply(rules, extend);
|
package/src/modules/base.mjs
CHANGED
|
@@ -96,6 +96,7 @@ function base(options = {}) {
|
|
|
96
96
|
'no-lonely-if': 'error',
|
|
97
97
|
'no-loop-func': 'error',
|
|
98
98
|
'no-loss-of-precision': 'warn',
|
|
99
|
+
'no-misleading-character-class': ['error', { allowEscape: true }],
|
|
99
100
|
'no-multi-assign': 'error',
|
|
100
101
|
'no-multi-str': 'error',
|
|
101
102
|
'no-new-func': 'error',
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import * as plugin from 'eslint-plugin-regexp';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @param { import('..').Options } options
|
|
5
|
+
* @return { Promise<import('eslint').Linter.Config> }
|
|
6
|
+
*/
|
|
7
|
+
function regex(options = {}) {
|
|
8
|
+
return {
|
|
9
|
+
plugins: { regexp: plugin },
|
|
10
|
+
settings: {
|
|
11
|
+
regexp: {
|
|
12
|
+
allowedCharacterRanges: options.regex.allowedCharacterRanges,
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
rules: {
|
|
16
|
+
'regexp/confusing-quantifier': 'warn',
|
|
17
|
+
'regexp/control-character-escape': 'error',
|
|
18
|
+
'regexp/letter-case': 'warn',
|
|
19
|
+
'regexp/match-any': 'error',
|
|
20
|
+
'regexp/negation': 'error',
|
|
21
|
+
'regexp/no-contradiction-with-assertion': 'error',
|
|
22
|
+
'regexp/no-dupe-characters-character-class': 'error',
|
|
23
|
+
'regexp/no-dupe-disjunctions': 'error',
|
|
24
|
+
'regexp/no-empty-alternative': 'warn',
|
|
25
|
+
'regexp/no-empty-capturing-group': 'error',
|
|
26
|
+
'regexp/no-empty-character-class': 'error',
|
|
27
|
+
'regexp/no-empty-group': 'error',
|
|
28
|
+
'regexp/no-empty-lookarounds-assertion': 'error',
|
|
29
|
+
'regexp/no-empty-string-literal': 'error',
|
|
30
|
+
'regexp/no-escape-backspace': 'error',
|
|
31
|
+
'regexp/no-extra-lookaround-assertions': 'error',
|
|
32
|
+
'regexp/no-invalid-regexp': 'error',
|
|
33
|
+
'regexp/no-invisible-character': 'error',
|
|
34
|
+
'regexp/no-lazy-ends': 'warn',
|
|
35
|
+
'regexp/no-legacy-features': 'error',
|
|
36
|
+
'regexp/no-misleading-capturing-group': 'error',
|
|
37
|
+
'regexp/no-misleading-unicode-character': 'error',
|
|
38
|
+
'regexp/no-missing-g-flag': 'error',
|
|
39
|
+
'regexp/no-non-standard-flag': 'error',
|
|
40
|
+
'regexp/no-obscure-range': 'error',
|
|
41
|
+
'regexp/no-optional-assertion': 'error',
|
|
42
|
+
'regexp/no-potentially-useless-backreference': 'warn',
|
|
43
|
+
'regexp/no-super-linear-backtracking': 'error',
|
|
44
|
+
'regexp/no-trivially-nested-assertion': 'error',
|
|
45
|
+
'regexp/no-trivially-nested-quantifier': 'error',
|
|
46
|
+
'regexp/no-unused-capturing-group': 'error',
|
|
47
|
+
'regexp/no-useless-assertions': 'error',
|
|
48
|
+
'regexp/no-useless-backreference': 'error',
|
|
49
|
+
'regexp/no-useless-character-class': 'error',
|
|
50
|
+
'regexp/no-useless-dollar-replacements': 'error',
|
|
51
|
+
'regexp/no-useless-escape': 'error',
|
|
52
|
+
'regexp/no-useless-flag': 'warn',
|
|
53
|
+
'regexp/no-useless-lazy': 'error',
|
|
54
|
+
'regexp/no-useless-non-capturing-group': 'error',
|
|
55
|
+
'regexp/no-useless-quantifier': 'error',
|
|
56
|
+
'regexp/no-useless-range': 'error',
|
|
57
|
+
'regexp/no-useless-set-operand': 'error',
|
|
58
|
+
'regexp/no-useless-string-literal': 'error',
|
|
59
|
+
'regexp/no-useless-two-nums-quantifier': 'error',
|
|
60
|
+
'regexp/no-zero-quantifier': 'error',
|
|
61
|
+
'regexp/optimal-lookaround-quantifier': 'warn',
|
|
62
|
+
'regexp/optimal-quantifier-concatenation': 'error',
|
|
63
|
+
'regexp/prefer-character-class': 'error',
|
|
64
|
+
'regexp/prefer-d': 'error',
|
|
65
|
+
'regexp/prefer-plus-quantifier': 'error',
|
|
66
|
+
'regexp/prefer-predefined-assertion': 'error',
|
|
67
|
+
'regexp/prefer-question-quantifier': 'error',
|
|
68
|
+
'regexp/prefer-range': 'error',
|
|
69
|
+
'regexp/prefer-set-operation': 'error',
|
|
70
|
+
'regexp/prefer-star-quantifier': 'error',
|
|
71
|
+
'regexp/prefer-unicode-codepoint-escapes': 'error',
|
|
72
|
+
'regexp/prefer-w': 'error',
|
|
73
|
+
'regexp/simplify-set-operations': 'error',
|
|
74
|
+
'regexp/sort-alternatives': 'warn',
|
|
75
|
+
'regexp/sort-character-class-elements': 'warn',
|
|
76
|
+
'regexp/sort-flags': 'warn',
|
|
77
|
+
'regexp/strict': 'error',
|
|
78
|
+
'regexp/use-ignore-case': 'error',
|
|
79
|
+
|
|
80
|
+
'no-invalid-regexp': 'off',
|
|
81
|
+
'no-useless-backreference': 'off',
|
|
82
|
+
'no-empty-character-class': 'off',
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export default regex;
|