@jsse/eslint-config 0.4.9 → 0.4.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/README.md +1 -1
- package/dist/cli.js +9 -6
- package/dist/index.d.ts +2 -1
- package/dist/index.js +29 -123
- package/dist/version-Cmu7XVG1.js +39 -0
- package/package.json +12 -9
- package/dist/esm/cli.d.ts +0 -1
- package/dist/esm/cli.js +0 -121
- package/dist/esm/config-fns.d.ts +0 -138
- package/dist/esm/config-fns.js +0 -161
- package/dist/esm/configs/antfu.d.ts +0 -4
- package/dist/esm/configs/antfu.js +0 -30
- package/dist/esm/configs/command.d.ts +0 -10
- package/dist/esm/configs/command.js +0 -17
- package/dist/esm/configs/de-morgan.d.ts +0 -2
- package/dist/esm/configs/de-morgan.js +0 -9
- package/dist/esm/configs/eslint-comments.d.ts +0 -2
- package/dist/esm/configs/eslint-comments.js +0 -16
- package/dist/esm/configs/gql.d.ts +0 -2
- package/dist/esm/configs/gql.js +0 -4
- package/dist/esm/configs/ignores.d.ts +0 -2
- package/dist/esm/configs/ignores.js +0 -9
- package/dist/esm/configs/imports.d.ts +0 -2
- package/dist/esm/configs/imports.js +0 -28
- package/dist/esm/configs/javascript.d.ts +0 -6
- package/dist/esm/configs/javascript.js +0 -262
- package/dist/esm/configs/jsdoc.d.ts +0 -2
- package/dist/esm/configs/jsdoc.js +0 -31
- package/dist/esm/configs/jsonc.d.ts +0 -4
- package/dist/esm/configs/jsonc.js +0 -76
- package/dist/esm/configs/markdown.d.ts +0 -4
- package/dist/esm/configs/markdown.js +0 -122
- package/dist/esm/configs/n.d.ts +0 -2
- package/dist/esm/configs/n.js +0 -21
- package/dist/esm/configs/no-only-tests.d.ts +0 -4
- package/dist/esm/configs/no-only-tests.js +0 -31
- package/dist/esm/configs/perfectionist.d.ts +0 -7
- package/dist/esm/configs/perfectionist.js +0 -60
- package/dist/esm/configs/pnpm.d.ts +0 -2
- package/dist/esm/configs/pnpm.js +0 -34
- package/dist/esm/configs/prettier.d.ts +0 -7
- package/dist/esm/configs/prettier.js +0 -126
- package/dist/esm/configs/react.d.ts +0 -6
- package/dist/esm/configs/react.js +0 -300
- package/dist/esm/configs/sort-package-json.d.ts +0 -7
- package/dist/esm/configs/sort-package-json.js +0 -102
- package/dist/esm/configs/sort-tsconfig.d.ts +0 -14
- package/dist/esm/configs/sort-tsconfig.js +0 -135
- package/dist/esm/configs/stylistic.d.ts +0 -2
- package/dist/esm/configs/stylistic.js +0 -39
- package/dist/esm/configs/tailwind.d.ts +0 -1
- package/dist/esm/configs/tailwind.js +0 -81
- package/dist/esm/configs/toml.d.ts +0 -2
- package/dist/esm/configs/toml.js +0 -50
- package/dist/esm/configs/ts/parser.d.ts +0 -7
- package/dist/esm/configs/ts/parser.js +0 -71
- package/dist/esm/configs/ts/requires-type-checking.d.ts +0 -1
- package/dist/esm/configs/ts/requires-type-checking.js +0 -61
- package/dist/esm/configs/ts/typescript-language-options.d.ts +0 -2
- package/dist/esm/configs/ts/typescript-language-options.js +0 -22
- package/dist/esm/configs/ts/typescript-rules.d.ts +0 -11
- package/dist/esm/configs/ts/typescript-rules.js +0 -379
- package/dist/esm/configs/ts/typescript.d.ts +0 -4
- package/dist/esm/configs/ts/typescript.js +0 -123
- package/dist/esm/configs/tsdoc.d.ts +0 -2
- package/dist/esm/configs/tsdoc.js +0 -16
- package/dist/esm/configs/unicorn.d.ts +0 -2
- package/dist/esm/configs/unicorn.js +0 -114
- package/dist/esm/configs/vitest.d.ts +0 -4
- package/dist/esm/configs/vitest.js +0 -29
- package/dist/esm/configs/yml.d.ts +0 -4
- package/dist/esm/configs/yml.js +0 -51
- package/dist/esm/const.d.ts +0 -5
- package/dist/esm/const.js +0 -25
- package/dist/esm/define-config.d.ts +0 -7
- package/dist/esm/define-config.js +0 -256
- package/dist/esm/dev.d.ts +0 -4
- package/dist/esm/dev.js +0 -25
- package/dist/esm/fixable.d.ts +0 -2
- package/dist/esm/fixable.js +0 -4
- package/dist/esm/generated/fixable-rules-map.d.ts +0 -2
- package/dist/esm/generated/fixable-rules-map.js +0 -443
- package/dist/esm/generated/version.d.ts +0 -1
- package/dist/esm/generated/version.js +0 -1
- package/dist/esm/globs.d.ts +0 -25
- package/dist/esm/globs.js +0 -73
- package/dist/esm/index.d.ts +0 -9
- package/dist/esm/index.js +0 -8
- package/dist/esm/lager.d.ts +0 -32
- package/dist/esm/lager.js +0 -87
- package/dist/esm/log.d.ts +0 -2
- package/dist/esm/log.js +0 -2
- package/dist/esm/plugins-all.d.ts +0 -26
- package/dist/esm/plugins-all.js +0 -120
- package/dist/esm/plugins.d.ts +0 -1570
- package/dist/esm/plugins.js +0 -97
- package/dist/esm/presets.d.ts +0 -18
- package/dist/esm/presets.js +0 -75
- package/dist/esm/types.d.ts +0 -287
- package/dist/esm/types.js +0 -1
- package/dist/esm/utils.d.ts +0 -51
- package/dist/esm/utils.js +0 -156
- package/dist/version-DNhPWuQE.js +0 -5
package/dist/esm/configs/pnpm.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { pluginPnpm } from "../plugins.js";
|
|
2
|
-
export const pnpm = async () => {
|
|
3
|
-
return [
|
|
4
|
-
{
|
|
5
|
-
files: ["package.json", "**/package.json"],
|
|
6
|
-
languageOptions: {
|
|
7
|
-
parser: await import("jsonc-eslint-parser"),
|
|
8
|
-
},
|
|
9
|
-
name: "jsse/pnpm/package-json",
|
|
10
|
-
plugins: {
|
|
11
|
-
pnpm: pluginPnpm,
|
|
12
|
-
},
|
|
13
|
-
rules: {
|
|
14
|
-
"pnpm/json-enforce-catalog": "error",
|
|
15
|
-
"pnpm/json-prefer-workspace-settings": "error",
|
|
16
|
-
"pnpm/json-valid-catalog": "error",
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
files: ["pnpm-workspace.yaml"],
|
|
21
|
-
languageOptions: {
|
|
22
|
-
parser: await import("yaml-eslint-parser"),
|
|
23
|
-
},
|
|
24
|
-
name: "jsse/pnpm/pnpm-workspace-yaml",
|
|
25
|
-
plugins: {
|
|
26
|
-
pnpm: pluginPnpm,
|
|
27
|
-
},
|
|
28
|
-
rules: {
|
|
29
|
-
"pnpm/yaml-no-duplicate-catalog-item": "error",
|
|
30
|
-
"pnpm/yaml-no-unused-catalog-item": "error",
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
];
|
|
34
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { Config, EslintConfigFn } from "../types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Copied from https://raw.githubusercontent.com/prettier/eslint-config-prettier/main/index.js
|
|
4
|
-
* Main difference is we exclude rules we don't care about.... (flow/babel/etc)
|
|
5
|
-
*/
|
|
6
|
-
export declare function eslintConfigPrettierRules(): Config["rules"];
|
|
7
|
-
export declare const prettier: EslintConfigFn;
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copied from https://raw.githubusercontent.com/prettier/eslint-config-prettier/main/index.js
|
|
3
|
-
* Main difference is we exclude rules we don't care about.... (flow/babel/etc)
|
|
4
|
-
*/
|
|
5
|
-
export function eslintConfigPrettierRules() {
|
|
6
|
-
return {
|
|
7
|
-
"@typescript-eslint/block-spacing": "off",
|
|
8
|
-
"@typescript-eslint/brace-style": "off",
|
|
9
|
-
"@typescript-eslint/comma-dangle": "off",
|
|
10
|
-
"@typescript-eslint/comma-spacing": "off",
|
|
11
|
-
"@typescript-eslint/func-call-spacing": "off",
|
|
12
|
-
"@typescript-eslint/indent": "off",
|
|
13
|
-
"@typescript-eslint/key-spacing": "off",
|
|
14
|
-
"@typescript-eslint/keyword-spacing": "off",
|
|
15
|
-
"@typescript-eslint/lines-around-comment": 0,
|
|
16
|
-
"@typescript-eslint/member-delimiter-style": "off",
|
|
17
|
-
"@typescript-eslint/no-extra-parens": "off",
|
|
18
|
-
"@typescript-eslint/no-extra-semi": "off",
|
|
19
|
-
"@typescript-eslint/object-curly-spacing": "off",
|
|
20
|
-
"@typescript-eslint/quotes": 0,
|
|
21
|
-
"@typescript-eslint/semi": "off",
|
|
22
|
-
"@typescript-eslint/space-before-blocks": "off",
|
|
23
|
-
"@typescript-eslint/space-before-function-paren": "off",
|
|
24
|
-
"@typescript-eslint/space-infix-ops": "off",
|
|
25
|
-
"@typescript-eslint/type-annotation-spacing": "off",
|
|
26
|
-
// The rest are rules that you never need to enable when using Prettier.
|
|
27
|
-
"array-bracket-newline": "off",
|
|
28
|
-
"array-bracket-spacing": "off",
|
|
29
|
-
"array-element-newline": "off",
|
|
30
|
-
"arrow-parens": "off",
|
|
31
|
-
"arrow-spacing": "off",
|
|
32
|
-
"block-spacing": "off",
|
|
33
|
-
"brace-style": "off",
|
|
34
|
-
"comma-dangle": "off",
|
|
35
|
-
"comma-spacing": "off",
|
|
36
|
-
"comma-style": "off",
|
|
37
|
-
"computed-property-spacing": "off",
|
|
38
|
-
// The following rules can be used in some cases. See the README for more
|
|
39
|
-
// information. (These are marked with `0` instead of `"off"` so that a
|
|
40
|
-
// script can distinguish them.)
|
|
41
|
-
curly: 0,
|
|
42
|
-
"dot-location": "off",
|
|
43
|
-
"eol-last": "off",
|
|
44
|
-
"func-call-spacing": "off",
|
|
45
|
-
"function-call-argument-newline": "off",
|
|
46
|
-
"function-paren-newline": "off",
|
|
47
|
-
"generator-star-spacing": "off",
|
|
48
|
-
"implicit-arrow-linebreak": "off",
|
|
49
|
-
indent: "off",
|
|
50
|
-
"jsx-quotes": "off",
|
|
51
|
-
"key-spacing": "off",
|
|
52
|
-
"keyword-spacing": "off",
|
|
53
|
-
"linebreak-style": "off",
|
|
54
|
-
"lines-around-comment": 0,
|
|
55
|
-
"max-len": 0,
|
|
56
|
-
"max-statements-per-line": "off",
|
|
57
|
-
"multiline-ternary": "off",
|
|
58
|
-
"new-parens": "off",
|
|
59
|
-
"newline-per-chained-call": "off",
|
|
60
|
-
"no-confusing-arrow": 0,
|
|
61
|
-
"no-extra-parens": "off",
|
|
62
|
-
"no-extra-semi": "off",
|
|
63
|
-
"no-floating-decimal": "off",
|
|
64
|
-
"no-mixed-operators": 0,
|
|
65
|
-
"no-mixed-spaces-and-tabs": "off",
|
|
66
|
-
"no-multi-spaces": "off",
|
|
67
|
-
"no-multiple-empty-lines": "off",
|
|
68
|
-
"no-tabs": 0,
|
|
69
|
-
"no-trailing-spaces": "off",
|
|
70
|
-
"no-unexpected-multiline": 0,
|
|
71
|
-
"no-whitespace-before-property": "off",
|
|
72
|
-
"nonblock-statement-body-position": "off",
|
|
73
|
-
"object-curly-newline": "off",
|
|
74
|
-
"object-curly-spacing": "off",
|
|
75
|
-
"object-property-newline": "off",
|
|
76
|
-
"one-var-declaration-per-line": "off",
|
|
77
|
-
"operator-linebreak": "off",
|
|
78
|
-
"padded-blocks": "off",
|
|
79
|
-
"quote-props": "off",
|
|
80
|
-
quotes: 0,
|
|
81
|
-
"react/jsx-child-element-spacing": "off",
|
|
82
|
-
"react/jsx-closing-bracket-location": "off",
|
|
83
|
-
"react/jsx-closing-tag-location": "off",
|
|
84
|
-
"react/jsx-curly-newline": "off",
|
|
85
|
-
"react/jsx-curly-spacing": "off",
|
|
86
|
-
"react/jsx-equals-spacing": "off",
|
|
87
|
-
"react/jsx-first-prop-new-line": "off",
|
|
88
|
-
"react/jsx-indent": "off",
|
|
89
|
-
"react/jsx-indent-props": "off",
|
|
90
|
-
"react/jsx-max-props-per-line": "off",
|
|
91
|
-
"react/jsx-newline": "off",
|
|
92
|
-
"react/jsx-one-expression-per-line": "off",
|
|
93
|
-
"react/jsx-props-no-multi-spaces": "off",
|
|
94
|
-
"react/jsx-tag-spacing": "off",
|
|
95
|
-
"react/jsx-wrap-multilines": "off",
|
|
96
|
-
"rest-spread-spacing": "off",
|
|
97
|
-
semi: "off",
|
|
98
|
-
"semi-spacing": "off",
|
|
99
|
-
"semi-style": "off",
|
|
100
|
-
"space-before-blocks": "off",
|
|
101
|
-
"space-before-function-paren": "off",
|
|
102
|
-
"space-in-parens": "off",
|
|
103
|
-
"space-infix-ops": "off",
|
|
104
|
-
"space-unary-ops": "off",
|
|
105
|
-
"standard/array-bracket-even-spacing": "off",
|
|
106
|
-
"standard/computed-property-even-spacing": "off",
|
|
107
|
-
"standard/object-curly-even-spacing": "off",
|
|
108
|
-
"switch-colon-spacing": "off",
|
|
109
|
-
"template-curly-spacing": "off",
|
|
110
|
-
"template-tag-spacing": "off",
|
|
111
|
-
"unicorn/empty-brace-spaces": "off",
|
|
112
|
-
"unicorn/no-nested-ternary": "off",
|
|
113
|
-
"unicorn/number-literal-case": "off",
|
|
114
|
-
"wrap-iife": "off",
|
|
115
|
-
"wrap-regex": "off",
|
|
116
|
-
"yield-star-spacing": "off",
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
export const prettier = async () => {
|
|
120
|
-
return [
|
|
121
|
-
{
|
|
122
|
-
name: "jsse/prettier/config",
|
|
123
|
-
rules: eslintConfigPrettierRules(),
|
|
124
|
-
},
|
|
125
|
-
];
|
|
126
|
-
};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { Config, EslintConfigFn, OptionsComponentExts, OptionsOverrides, OptionsReact, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes } from "../types.js";
|
|
2
|
-
export declare function reactRules(): Config["rules"];
|
|
3
|
-
export declare function reactHooks(): Promise<Config[]>;
|
|
4
|
-
type ReactOptions = OptionsComponentExts & OptionsOverrides & OptionsTypeScriptWithTypes & OptionsTypeScriptParserOptions & OptionsReact;
|
|
5
|
-
export declare const react: EslintConfigFn<ReactOptions>;
|
|
6
|
-
export {};
|
|
@@ -1,300 +0,0 @@
|
|
|
1
|
-
import { fixupPluginRules } from "@eslint/compat";
|
|
2
|
-
import { GLOB_JSX, GLOB_SRC, GLOB_TSX } from "../globs.js";
|
|
3
|
-
import { importPluginReactHooks, importReactPlugins } from "../plugins.js";
|
|
4
|
-
import { typescriptLanguageOptions } from "./ts/typescript-language-options.js";
|
|
5
|
-
export function reactRules() {
|
|
6
|
-
return {
|
|
7
|
-
"react-hooks/exhaustive-deps": "error",
|
|
8
|
-
"react-hooks/rules-of-hooks": "error",
|
|
9
|
-
"react/boolean-prop-naming": [
|
|
10
|
-
"error",
|
|
11
|
-
{
|
|
12
|
-
rule: [
|
|
13
|
-
"^(is|has)[A-Z]([A-Za-z0-9]?)+",
|
|
14
|
-
"|^(debug|disabled|hidden|required|selected|highlight)$",
|
|
15
|
-
].join(""),
|
|
16
|
-
validateNested: true,
|
|
17
|
-
},
|
|
18
|
-
],
|
|
19
|
-
"react/button-has-type": "error",
|
|
20
|
-
"react/function-component-definition": [
|
|
21
|
-
"error",
|
|
22
|
-
{
|
|
23
|
-
namedComponents: "function-declaration",
|
|
24
|
-
unnamedComponents: "arrow-function",
|
|
25
|
-
},
|
|
26
|
-
],
|
|
27
|
-
"react/hook-use-state": "error",
|
|
28
|
-
"react/iframe-missing-sandbox": "error",
|
|
29
|
-
"react/jsx-boolean-value": "error",
|
|
30
|
-
"react/jsx-child-element-spacing": "error",
|
|
31
|
-
"react/jsx-closing-bracket-location": [
|
|
32
|
-
"error",
|
|
33
|
-
{
|
|
34
|
-
nonEmpty: "tag-aligned",
|
|
35
|
-
selfClosing: false,
|
|
36
|
-
},
|
|
37
|
-
],
|
|
38
|
-
"react/jsx-closing-tag-location": "error",
|
|
39
|
-
"react/jsx-curly-brace-presence": [
|
|
40
|
-
"error",
|
|
41
|
-
{
|
|
42
|
-
children: "never",
|
|
43
|
-
propElementValues: "always",
|
|
44
|
-
props: "never",
|
|
45
|
-
},
|
|
46
|
-
],
|
|
47
|
-
"react/jsx-curly-newline": [
|
|
48
|
-
"error",
|
|
49
|
-
{
|
|
50
|
-
multiline: "consistent",
|
|
51
|
-
singleline: "forbid",
|
|
52
|
-
},
|
|
53
|
-
],
|
|
54
|
-
"react/jsx-curly-spacing": ["error", "never"],
|
|
55
|
-
"react/jsx-equals-spacing": ["error", "never"],
|
|
56
|
-
"react/jsx-first-prop-new-line": "error",
|
|
57
|
-
"react/jsx-fragments": ["error", "syntax"],
|
|
58
|
-
"react/jsx-indent": ["error", 2],
|
|
59
|
-
"react/jsx-indent-props": ["error", 2],
|
|
60
|
-
"react/jsx-key": "warn",
|
|
61
|
-
"react/jsx-max-props-per-line": [
|
|
62
|
-
"error",
|
|
63
|
-
{
|
|
64
|
-
maximum: 3,
|
|
65
|
-
when: "multiline",
|
|
66
|
-
},
|
|
67
|
-
],
|
|
68
|
-
"react/jsx-no-bind": [
|
|
69
|
-
"error",
|
|
70
|
-
{
|
|
71
|
-
allowArrowFunctions: true,
|
|
72
|
-
},
|
|
73
|
-
],
|
|
74
|
-
"react/jsx-no-comment-textnodes": "error",
|
|
75
|
-
"react/jsx-no-constructed-context-values": "error",
|
|
76
|
-
"react/jsx-no-duplicate-props": [
|
|
77
|
-
"error",
|
|
78
|
-
{
|
|
79
|
-
ignoreCase: true,
|
|
80
|
-
},
|
|
81
|
-
],
|
|
82
|
-
"react/jsx-no-script-url": "error",
|
|
83
|
-
"react/jsx-no-target-blank": [
|
|
84
|
-
"error",
|
|
85
|
-
{
|
|
86
|
-
allowReferrer: true,
|
|
87
|
-
forms: true,
|
|
88
|
-
warnOnSpreadAttributes: true,
|
|
89
|
-
},
|
|
90
|
-
],
|
|
91
|
-
"react/jsx-no-undef": "error",
|
|
92
|
-
"react/jsx-no-useless-fragment": "error",
|
|
93
|
-
"react/jsx-pascal-case": "error",
|
|
94
|
-
"react/jsx-props-no-multi-spaces": "error",
|
|
95
|
-
"react/jsx-sort-props": [
|
|
96
|
-
"error",
|
|
97
|
-
{
|
|
98
|
-
callbacksLast: true,
|
|
99
|
-
noSortAlphabetically: true,
|
|
100
|
-
reservedFirst: true,
|
|
101
|
-
shorthandFirst: true,
|
|
102
|
-
},
|
|
103
|
-
],
|
|
104
|
-
"react/jsx-tag-spacing": [
|
|
105
|
-
"error",
|
|
106
|
-
{
|
|
107
|
-
afterOpening: "never",
|
|
108
|
-
beforeClosing: "never",
|
|
109
|
-
beforeSelfClosing: "never",
|
|
110
|
-
closingSlash: "never",
|
|
111
|
-
},
|
|
112
|
-
],
|
|
113
|
-
"react/jsx-uses-react": "error",
|
|
114
|
-
"react/jsx-uses-vars": "error",
|
|
115
|
-
"react/jsx-wrap-multilines": [
|
|
116
|
-
"error",
|
|
117
|
-
{
|
|
118
|
-
arrow: "parens-new-line",
|
|
119
|
-
assignment: "parens-new-line",
|
|
120
|
-
condition: "ignore",
|
|
121
|
-
declaration: "parens-new-line",
|
|
122
|
-
logical: "ignore",
|
|
123
|
-
prop: "ignore",
|
|
124
|
-
return: "parens-new-line",
|
|
125
|
-
},
|
|
126
|
-
],
|
|
127
|
-
// "react/no-access-state-in-setstate": "error",
|
|
128
|
-
"react/no-array-index-key": "error",
|
|
129
|
-
"react/no-arrow-function-lifecycle": "error",
|
|
130
|
-
"react/no-children-prop": "error",
|
|
131
|
-
"react/no-danger": "error",
|
|
132
|
-
"react/no-danger-with-children": "error",
|
|
133
|
-
"react/no-deprecated": "error",
|
|
134
|
-
"react/no-did-update-set-state": "error",
|
|
135
|
-
"react/no-direct-mutation-state": "error",
|
|
136
|
-
"react/no-find-dom-node": "error",
|
|
137
|
-
"react/no-invalid-html-attribute": "error",
|
|
138
|
-
"react/no-is-mounted": "error",
|
|
139
|
-
"react/no-namespace": "error",
|
|
140
|
-
"react/no-redundant-should-component-update": "error",
|
|
141
|
-
"react/no-render-return-value": "error",
|
|
142
|
-
"react/no-string-refs": [
|
|
143
|
-
"error",
|
|
144
|
-
{
|
|
145
|
-
noTemplateLiterals: true,
|
|
146
|
-
},
|
|
147
|
-
],
|
|
148
|
-
"react/no-this-in-sfc": "error",
|
|
149
|
-
"react/no-typos": "error",
|
|
150
|
-
"react/no-unescaped-entities": "error",
|
|
151
|
-
"react/no-unsafe": "error",
|
|
152
|
-
"react/no-unstable-nested-components": "error",
|
|
153
|
-
// "react/no-unused-prop-types": "error",
|
|
154
|
-
"react/no-unused-state": "error",
|
|
155
|
-
"react/prefer-read-only-props": "error",
|
|
156
|
-
// "react/prop-types": "error",
|
|
157
|
-
"react/react-in-jsx-scope": "off", // not needed anymore!
|
|
158
|
-
"react/require-default-props": [
|
|
159
|
-
"error",
|
|
160
|
-
{
|
|
161
|
-
forbidDefaultForRequired: true,
|
|
162
|
-
ignoreFunctionalComponents: true,
|
|
163
|
-
},
|
|
164
|
-
],
|
|
165
|
-
"react/self-closing-comp": "error",
|
|
166
|
-
"react/state-in-constructor": ["error", "never"],
|
|
167
|
-
"react/static-property-placement": "error",
|
|
168
|
-
"react/style-prop-object": [
|
|
169
|
-
"error",
|
|
170
|
-
{
|
|
171
|
-
allow: ["FormattedNumber"],
|
|
172
|
-
},
|
|
173
|
-
],
|
|
174
|
-
"react/void-dom-elements-no-children": "error",
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
export async function reactHooks() {
|
|
178
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
179
|
-
const { pluginReactHooks } = await importPluginReactHooks();
|
|
180
|
-
return [
|
|
181
|
-
{
|
|
182
|
-
files: [GLOB_SRC],
|
|
183
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
184
|
-
plugins: { "react-hooks": pluginReactHooks },
|
|
185
|
-
rules: {
|
|
186
|
-
"react-hooks/exhaustive-deps": "error",
|
|
187
|
-
"react-hooks/rules-of-hooks": "error",
|
|
188
|
-
},
|
|
189
|
-
},
|
|
190
|
-
];
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* Stupid prop types causes test error
|
|
194
|
-
*/
|
|
195
|
-
function reactRecomendedRules() {
|
|
196
|
-
return {
|
|
197
|
-
"react/display-name": 2,
|
|
198
|
-
"react/jsx-key": 2,
|
|
199
|
-
"react/jsx-no-comment-textnodes": 2,
|
|
200
|
-
"react/jsx-no-duplicate-props": 2,
|
|
201
|
-
"react/jsx-no-target-blank": 2,
|
|
202
|
-
"react/jsx-no-undef": 2,
|
|
203
|
-
"react/jsx-uses-react": 2,
|
|
204
|
-
"react/jsx-uses-vars": 2,
|
|
205
|
-
"react/no-children-prop": 2,
|
|
206
|
-
"react/no-danger-with-children": 2,
|
|
207
|
-
"react/no-deprecated": 2,
|
|
208
|
-
"react/no-direct-mutation-state": 2,
|
|
209
|
-
"react/no-find-dom-node": 2,
|
|
210
|
-
"react/no-is-mounted": 2,
|
|
211
|
-
"react/no-render-return-value": 2,
|
|
212
|
-
"react/no-string-refs": 2,
|
|
213
|
-
"react/no-unescaped-entities": 2,
|
|
214
|
-
// this rule has a bug w/ typescript-eslint-parser
|
|
215
|
-
// 'react/no-unknown-property': 2,
|
|
216
|
-
"react/no-unsafe": 0,
|
|
217
|
-
"react/prop-types": 1,
|
|
218
|
-
"react/react-in-jsx-scope": 2,
|
|
219
|
-
"react/require-render-return": 2,
|
|
220
|
-
};
|
|
221
|
-
}
|
|
222
|
-
export const react = async (options) => {
|
|
223
|
-
const { componentExts, parserOptions = {}, react, reactRefresh, tsconfig, } = options ?? {};
|
|
224
|
-
const reactPlugins = await importReactPlugins();
|
|
225
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
226
|
-
const { pluginReact, pluginReactHooks, pluginReactRefresh } = reactPlugins;
|
|
227
|
-
const config = [
|
|
228
|
-
{
|
|
229
|
-
files: [GLOB_SRC],
|
|
230
|
-
languageOptions: typescriptLanguageOptions({
|
|
231
|
-
componentExts,
|
|
232
|
-
parserOptions,
|
|
233
|
-
react,
|
|
234
|
-
tsconfig,
|
|
235
|
-
}),
|
|
236
|
-
name: "jsse/react/setup",
|
|
237
|
-
plugins: {
|
|
238
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
239
|
-
react: pluginReact,
|
|
240
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
241
|
-
"react-hooks": fixupPluginRules(pluginReactHooks),
|
|
242
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
243
|
-
"react-refresh": pluginReactRefresh,
|
|
244
|
-
},
|
|
245
|
-
},
|
|
246
|
-
{
|
|
247
|
-
files: [GLOB_SRC],
|
|
248
|
-
name: "jsse/react/rules",
|
|
249
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
250
|
-
rules: {
|
|
251
|
-
...reactRecomendedRules(),
|
|
252
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
253
|
-
...pluginReact.configs["jsx-runtime"].rules,
|
|
254
|
-
...reactRules(),
|
|
255
|
-
},
|
|
256
|
-
settings: {
|
|
257
|
-
react: {
|
|
258
|
-
version: "detect",
|
|
259
|
-
},
|
|
260
|
-
},
|
|
261
|
-
},
|
|
262
|
-
{
|
|
263
|
-
files: [GLOB_SRC],
|
|
264
|
-
name: "jsse/react-hooks/rules",
|
|
265
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
266
|
-
rules: {
|
|
267
|
-
"react-hooks/exhaustive-deps": "error",
|
|
268
|
-
"react-hooks/rules-of-hooks": "error",
|
|
269
|
-
},
|
|
270
|
-
settings: {
|
|
271
|
-
react: {
|
|
272
|
-
version: "detect",
|
|
273
|
-
},
|
|
274
|
-
},
|
|
275
|
-
},
|
|
276
|
-
{
|
|
277
|
-
files: [GLOB_JSX, GLOB_TSX],
|
|
278
|
-
name: "jsse/react/disables",
|
|
279
|
-
rules: {
|
|
280
|
-
"unicorn/no-null": "off", // null is bueno in react
|
|
281
|
-
},
|
|
282
|
-
},
|
|
283
|
-
];
|
|
284
|
-
if (reactRefresh) {
|
|
285
|
-
config.push({
|
|
286
|
-
files: [GLOB_SRC],
|
|
287
|
-
name: "jsse/react/refresh",
|
|
288
|
-
rules: {
|
|
289
|
-
"react-refresh/only-export-components": "error",
|
|
290
|
-
},
|
|
291
|
-
}, {
|
|
292
|
-
files: ["**/*.stories.tsx"],
|
|
293
|
-
name: "jsse/react-refresh/stories",
|
|
294
|
-
rules: {
|
|
295
|
-
"react-refresh/only-export-components": "off",
|
|
296
|
-
},
|
|
297
|
-
});
|
|
298
|
-
}
|
|
299
|
-
return config;
|
|
300
|
-
};
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sort package.json
|
|
3
|
-
*
|
|
4
|
-
* Requires `jsonc` config
|
|
5
|
-
*/
|
|
6
|
-
export const sortPackageJson = async () => {
|
|
7
|
-
return [
|
|
8
|
-
{
|
|
9
|
-
files: ["**/package.json"],
|
|
10
|
-
name: "jsse/sort/package-json",
|
|
11
|
-
rules: {
|
|
12
|
-
"jsonc/sort-array-values": [
|
|
13
|
-
"error",
|
|
14
|
-
{
|
|
15
|
-
order: { type: "asc" },
|
|
16
|
-
pathPattern: "^files$",
|
|
17
|
-
},
|
|
18
|
-
],
|
|
19
|
-
"jsonc/sort-keys": [
|
|
20
|
-
"error",
|
|
21
|
-
{
|
|
22
|
-
order: [
|
|
23
|
-
"publisher",
|
|
24
|
-
"name",
|
|
25
|
-
"displayName",
|
|
26
|
-
"type",
|
|
27
|
-
"version",
|
|
28
|
-
"private",
|
|
29
|
-
"packageManager",
|
|
30
|
-
"description",
|
|
31
|
-
"author",
|
|
32
|
-
"contributors",
|
|
33
|
-
"license",
|
|
34
|
-
"funding",
|
|
35
|
-
"homepage",
|
|
36
|
-
"repository",
|
|
37
|
-
"bugs",
|
|
38
|
-
"keywords",
|
|
39
|
-
"categories",
|
|
40
|
-
"sideEffects",
|
|
41
|
-
"imports",
|
|
42
|
-
"exports",
|
|
43
|
-
"main",
|
|
44
|
-
"module",
|
|
45
|
-
"unpkg",
|
|
46
|
-
"jsdelivr",
|
|
47
|
-
"types",
|
|
48
|
-
"typesVersions",
|
|
49
|
-
"bin",
|
|
50
|
-
"icon",
|
|
51
|
-
"files",
|
|
52
|
-
"engines",
|
|
53
|
-
"activationEvents",
|
|
54
|
-
"contributes",
|
|
55
|
-
"scripts",
|
|
56
|
-
"peerDependencies",
|
|
57
|
-
"peerDependenciesMeta",
|
|
58
|
-
"dependencies",
|
|
59
|
-
"optionalDependencies",
|
|
60
|
-
"devDependencies",
|
|
61
|
-
"pnpm",
|
|
62
|
-
"overrides",
|
|
63
|
-
"resolutions",
|
|
64
|
-
"husky",
|
|
65
|
-
"simple-git-hooks",
|
|
66
|
-
"lint-staged",
|
|
67
|
-
"eslintConfig",
|
|
68
|
-
],
|
|
69
|
-
pathPattern: "^$",
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
order: { type: "asc" },
|
|
73
|
-
pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies(Meta)?$",
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
order: { type: "asc" },
|
|
77
|
-
pathPattern: "^(?:resolutions|overrides|pnpm.overrides)$",
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
order: ["types", "import", "require", "default"],
|
|
81
|
-
pathPattern: "^exports.*$",
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
order: [
|
|
85
|
-
"pre-commit",
|
|
86
|
-
"prepare-commit-msg",
|
|
87
|
-
"commit-msg",
|
|
88
|
-
"post-commit",
|
|
89
|
-
"pre-rebase",
|
|
90
|
-
"post-rewrite",
|
|
91
|
-
"post-checkout",
|
|
92
|
-
"post-merge",
|
|
93
|
-
"pre-push",
|
|
94
|
-
"pre-auto-gc",
|
|
95
|
-
],
|
|
96
|
-
pathPattern: "^(?:gitHooks|husky|simple-git-hooks)$",
|
|
97
|
-
},
|
|
98
|
-
],
|
|
99
|
-
},
|
|
100
|
-
},
|
|
101
|
-
];
|
|
102
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { EslintConfigFn } from "../types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Sort tsconfig.json
|
|
4
|
-
*
|
|
5
|
-
* Requires `jsonc` config
|
|
6
|
-
*/
|
|
7
|
-
type SortTsconfigOptions = {
|
|
8
|
-
/**
|
|
9
|
-
* Extend files to be treated as tsconfig files
|
|
10
|
-
*/
|
|
11
|
-
extendTsconfigGlobs?: string[];
|
|
12
|
-
};
|
|
13
|
-
export declare const sortTsconfig: EslintConfigFn<SortTsconfigOptions>;
|
|
14
|
-
export {};
|