@utilfirst/eslint-plugin 0.3.0 → 0.4.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 +60 -74
- package/dist/index.js +1 -2466
- package/dist/oxlint.d.ts +174 -0
- package/dist/oxlint.js +167 -0
- package/dist/src-Bthhlf8v.js +3869 -0
- package/package.json +12 -8
package/dist/oxlint.d.ts
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
//#region src/oxlint.d.ts
|
|
2
|
+
/** Shared Oxlint policy for TypeScript and React repositories. */
|
|
3
|
+
declare const oxlintBaseConfig: {
|
|
4
|
+
categories: {
|
|
5
|
+
correctness: "error";
|
|
6
|
+
pedantic: "error";
|
|
7
|
+
perf: "error";
|
|
8
|
+
suspicious: "error";
|
|
9
|
+
};
|
|
10
|
+
env: {
|
|
11
|
+
builtin: true;
|
|
12
|
+
es2024: true;
|
|
13
|
+
"shared-node-browser": true;
|
|
14
|
+
};
|
|
15
|
+
jsPlugins: {
|
|
16
|
+
name: string;
|
|
17
|
+
specifier: string;
|
|
18
|
+
}[];
|
|
19
|
+
options: {
|
|
20
|
+
typeAware: true;
|
|
21
|
+
typeCheck: true;
|
|
22
|
+
};
|
|
23
|
+
overrides: ({
|
|
24
|
+
files: string[];
|
|
25
|
+
rules: {
|
|
26
|
+
"constructor-super": "off";
|
|
27
|
+
"getter-return": "off";
|
|
28
|
+
"no-class-assign": "off";
|
|
29
|
+
"no-const-assign": "off";
|
|
30
|
+
"no-func-assign": "off";
|
|
31
|
+
"no-import-assign": "off";
|
|
32
|
+
"no-new-native-nonconstructor": "off";
|
|
33
|
+
"no-obj-calls": "off";
|
|
34
|
+
"no-setter-return": "off";
|
|
35
|
+
"no-this-before-super": "off";
|
|
36
|
+
"no-unused-vars": "off";
|
|
37
|
+
"typescript/require-await"?: never;
|
|
38
|
+
};
|
|
39
|
+
} | {
|
|
40
|
+
files: string[];
|
|
41
|
+
rules: {
|
|
42
|
+
"typescript/require-await": "off";
|
|
43
|
+
"constructor-super"?: never;
|
|
44
|
+
"getter-return"?: never;
|
|
45
|
+
"no-class-assign"?: never;
|
|
46
|
+
"no-const-assign"?: never;
|
|
47
|
+
"no-func-assign"?: never;
|
|
48
|
+
"no-import-assign"?: never;
|
|
49
|
+
"no-new-native-nonconstructor"?: never;
|
|
50
|
+
"no-obj-calls"?: never;
|
|
51
|
+
"no-setter-return"?: never;
|
|
52
|
+
"no-this-before-super"?: never;
|
|
53
|
+
"no-unused-vars"?: never;
|
|
54
|
+
};
|
|
55
|
+
})[];
|
|
56
|
+
plugins: ("eslint" | "react" | "unicorn" | "typescript" | "oxc" | "import" | "vitest" | "promise")[];
|
|
57
|
+
rules: {
|
|
58
|
+
"arrow-body-style": ["error", "as-needed"];
|
|
59
|
+
curly: "error";
|
|
60
|
+
eqeqeq: ["error", "smart"];
|
|
61
|
+
"import/export": "error";
|
|
62
|
+
"import/first": "error";
|
|
63
|
+
"import/max-dependencies": "off";
|
|
64
|
+
"import/no-duplicates": "error";
|
|
65
|
+
"import/no-unassigned-import": "off";
|
|
66
|
+
"max-lines": "off";
|
|
67
|
+
"max-lines-per-function": "off";
|
|
68
|
+
"no-await-in-loop": "off";
|
|
69
|
+
"no-else-return": "error";
|
|
70
|
+
"no-negated-condition": "off";
|
|
71
|
+
"no-nested-ternary": "error";
|
|
72
|
+
"no-shadow": "error";
|
|
73
|
+
"no-underscore-dangle": "off";
|
|
74
|
+
"no-useless-assignment": "error";
|
|
75
|
+
"object-shorthand": "error";
|
|
76
|
+
"prefer-arrow-callback": ["error", {
|
|
77
|
+
allowNamedFunctions: true;
|
|
78
|
+
}];
|
|
79
|
+
"prefer-const": "error";
|
|
80
|
+
"prefer-rest-params": "error";
|
|
81
|
+
"prefer-spread": "error";
|
|
82
|
+
"promise/catch-or-return": "error";
|
|
83
|
+
"promise/no-nesting": "error";
|
|
84
|
+
"promise/no-return-in-finally": "error";
|
|
85
|
+
"promise/no-return-wrap": "error";
|
|
86
|
+
"promise/param-names": "error";
|
|
87
|
+
"react/exhaustive-deps": "error";
|
|
88
|
+
"react/function-component-definition": "error";
|
|
89
|
+
"react/hook-use-state": "error";
|
|
90
|
+
"react/jsx-curly-brace-presence": "error";
|
|
91
|
+
"react/jsx-no-constructed-context-values": "error";
|
|
92
|
+
"react/jsx-no-useless-fragment": "error";
|
|
93
|
+
"react/jsx-pascal-case": "error";
|
|
94
|
+
"react/no-unstable-nested-components": "error";
|
|
95
|
+
"react/no-unescaped-entities": "off";
|
|
96
|
+
"react/react-in-jsx-scope": "off";
|
|
97
|
+
"react/rules-of-hooks": "error";
|
|
98
|
+
"require-await": "off";
|
|
99
|
+
"typescript/adjacent-overload-signatures": "error";
|
|
100
|
+
"typescript/array-type": "error";
|
|
101
|
+
"typescript/ban-tslint-comment": "error";
|
|
102
|
+
"typescript/class-literal-property-style": "error";
|
|
103
|
+
"typescript/consistent-generic-constructors": "error";
|
|
104
|
+
"typescript/consistent-indexed-object-style": "error";
|
|
105
|
+
"typescript/consistent-type-assertions": "error";
|
|
106
|
+
"typescript/consistent-type-definitions": ["error", "type"];
|
|
107
|
+
"typescript/consistent-type-imports": ["error", {
|
|
108
|
+
fixStyle: "inline-type-imports";
|
|
109
|
+
prefer: "type-imports";
|
|
110
|
+
}];
|
|
111
|
+
"typescript/consistent-return": "off";
|
|
112
|
+
"typescript/dot-notation": "error";
|
|
113
|
+
"typescript/no-dynamic-delete": "error";
|
|
114
|
+
"typescript/no-empty-object-type": "error";
|
|
115
|
+
"typescript/no-explicit-any": "error";
|
|
116
|
+
"typescript/no-floating-promises": "error";
|
|
117
|
+
"typescript/no-inferrable-types": "error";
|
|
118
|
+
"typescript/no-invalid-void-type": "error";
|
|
119
|
+
"typescript/no-misused-promises": "error";
|
|
120
|
+
"typescript/no-namespace": "error";
|
|
121
|
+
"typescript/no-non-null-asserted-nullish-coalescing": "error";
|
|
122
|
+
"typescript/no-require-imports": "error";
|
|
123
|
+
"typescript/no-unnecessary-boolean-literal-compare": "error";
|
|
124
|
+
"typescript/no-unnecessary-condition": ["error", {
|
|
125
|
+
allowConstantLoopConditions: true;
|
|
126
|
+
}];
|
|
127
|
+
"typescript/no-unnecessary-template-expression": "error";
|
|
128
|
+
"typescript/non-nullable-type-assertion-style": "error";
|
|
129
|
+
"typescript/prefer-as-const": "error";
|
|
130
|
+
"typescript/prefer-find": "error";
|
|
131
|
+
"typescript/prefer-for-of": "error";
|
|
132
|
+
"typescript/prefer-function-type": "error";
|
|
133
|
+
"typescript/prefer-literal-enum-member": "error";
|
|
134
|
+
"typescript/prefer-readonly-parameter-types": "off";
|
|
135
|
+
"typescript/prefer-reduce-type-parameter": "error";
|
|
136
|
+
"typescript/prefer-regexp-exec": "error";
|
|
137
|
+
"typescript/prefer-return-this-type": "error";
|
|
138
|
+
"typescript/prefer-string-starts-ends-with": "error";
|
|
139
|
+
"typescript/restrict-plus-operands": ["error", {
|
|
140
|
+
allowAny: false;
|
|
141
|
+
allowBoolean: false;
|
|
142
|
+
allowNullish: false;
|
|
143
|
+
allowNumberAndString: false;
|
|
144
|
+
allowRegExp: false;
|
|
145
|
+
}];
|
|
146
|
+
"typescript/return-await": ["error", "error-handling-correctness-only"];
|
|
147
|
+
"typescript/strict-boolean-expressions": ["error", {
|
|
148
|
+
allowAny: false;
|
|
149
|
+
allowNullableBoolean: true;
|
|
150
|
+
allowNullableEnum: false;
|
|
151
|
+
allowNullableNumber: false;
|
|
152
|
+
allowNullableObject: true;
|
|
153
|
+
allowNullableString: false;
|
|
154
|
+
allowNumber: false;
|
|
155
|
+
allowString: false;
|
|
156
|
+
}];
|
|
157
|
+
"typescript/switch-exhaustiveness-check": "error";
|
|
158
|
+
"typescript/unified-signatures": "error";
|
|
159
|
+
"typescript/use-unknown-in-catch-callback-variable": "error";
|
|
160
|
+
"unicode-bom": ["error", "never"];
|
|
161
|
+
"unicorn/consistent-function-scoping": "error";
|
|
162
|
+
"unicorn/no-negated-condition": "off";
|
|
163
|
+
"unicorn/no-useless-undefined": "off";
|
|
164
|
+
"unicorn/prefer-top-level-await": "off";
|
|
165
|
+
"vitest/no-conditional-in-test": "off";
|
|
166
|
+
};
|
|
167
|
+
settings: {
|
|
168
|
+
react: {
|
|
169
|
+
version: string;
|
|
170
|
+
};
|
|
171
|
+
};
|
|
172
|
+
};
|
|
173
|
+
//#endregion
|
|
174
|
+
export { oxlintBaseConfig };
|
package/dist/oxlint.js
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { t as src_default } from "./src-Bthhlf8v.js";
|
|
2
|
+
import { defineConfig } from "oxlint";
|
|
3
|
+
|
|
4
|
+
//#region src/oxlint.ts
|
|
5
|
+
const utilfirstRules = Object.fromEntries(Object.keys(src_default.rules).map((ruleName) => [`utilfirst/${ruleName}`, "error"]));
|
|
6
|
+
/** Shared Oxlint policy for TypeScript and React repositories. */
|
|
7
|
+
const oxlintBaseConfig = defineConfig({
|
|
8
|
+
categories: {
|
|
9
|
+
correctness: "error",
|
|
10
|
+
pedantic: "error",
|
|
11
|
+
perf: "error",
|
|
12
|
+
suspicious: "error"
|
|
13
|
+
},
|
|
14
|
+
env: {
|
|
15
|
+
"builtin": true,
|
|
16
|
+
"es2024": true,
|
|
17
|
+
"shared-node-browser": true
|
|
18
|
+
},
|
|
19
|
+
jsPlugins: [{
|
|
20
|
+
name: "utilfirst",
|
|
21
|
+
specifier: "@utilfirst/eslint-plugin"
|
|
22
|
+
}],
|
|
23
|
+
options: {
|
|
24
|
+
typeAware: true,
|
|
25
|
+
typeCheck: true
|
|
26
|
+
},
|
|
27
|
+
overrides: [{
|
|
28
|
+
files: ["**/*.{ts,tsx,mts,cts}"],
|
|
29
|
+
rules: {
|
|
30
|
+
"constructor-super": "off",
|
|
31
|
+
"getter-return": "off",
|
|
32
|
+
"no-class-assign": "off",
|
|
33
|
+
"no-const-assign": "off",
|
|
34
|
+
"no-func-assign": "off",
|
|
35
|
+
"no-import-assign": "off",
|
|
36
|
+
"no-new-native-nonconstructor": "off",
|
|
37
|
+
"no-obj-calls": "off",
|
|
38
|
+
"no-setter-return": "off",
|
|
39
|
+
"no-this-before-super": "off",
|
|
40
|
+
"no-unused-vars": "off"
|
|
41
|
+
}
|
|
42
|
+
}, {
|
|
43
|
+
files: ["**/*.test.{ts,tsx,mts,cts}"],
|
|
44
|
+
rules: { "typescript/require-await": "off" }
|
|
45
|
+
}],
|
|
46
|
+
plugins: [
|
|
47
|
+
"eslint",
|
|
48
|
+
"import",
|
|
49
|
+
"oxc",
|
|
50
|
+
"promise",
|
|
51
|
+
"react",
|
|
52
|
+
"typescript",
|
|
53
|
+
"unicorn",
|
|
54
|
+
"vitest"
|
|
55
|
+
],
|
|
56
|
+
rules: {
|
|
57
|
+
...utilfirstRules,
|
|
58
|
+
"arrow-body-style": ["error", "as-needed"],
|
|
59
|
+
"curly": "error",
|
|
60
|
+
"eqeqeq": ["error", "smart"],
|
|
61
|
+
"import/export": "error",
|
|
62
|
+
"import/first": "error",
|
|
63
|
+
"import/max-dependencies": "off",
|
|
64
|
+
"import/no-duplicates": "error",
|
|
65
|
+
"import/no-unassigned-import": "off",
|
|
66
|
+
"max-lines": "off",
|
|
67
|
+
"max-lines-per-function": "off",
|
|
68
|
+
"no-await-in-loop": "off",
|
|
69
|
+
"no-else-return": "error",
|
|
70
|
+
"no-negated-condition": "off",
|
|
71
|
+
"no-nested-ternary": "error",
|
|
72
|
+
"no-shadow": "error",
|
|
73
|
+
"no-underscore-dangle": "off",
|
|
74
|
+
"no-useless-assignment": "error",
|
|
75
|
+
"object-shorthand": "error",
|
|
76
|
+
"prefer-arrow-callback": ["error", { allowNamedFunctions: true }],
|
|
77
|
+
"prefer-const": "error",
|
|
78
|
+
"prefer-rest-params": "error",
|
|
79
|
+
"prefer-spread": "error",
|
|
80
|
+
"promise/catch-or-return": "error",
|
|
81
|
+
"promise/no-nesting": "error",
|
|
82
|
+
"promise/no-return-in-finally": "error",
|
|
83
|
+
"promise/no-return-wrap": "error",
|
|
84
|
+
"promise/param-names": "error",
|
|
85
|
+
"react/exhaustive-deps": "error",
|
|
86
|
+
"react/function-component-definition": "error",
|
|
87
|
+
"react/hook-use-state": "error",
|
|
88
|
+
"react/jsx-curly-brace-presence": "error",
|
|
89
|
+
"react/jsx-no-constructed-context-values": "error",
|
|
90
|
+
"react/jsx-no-useless-fragment": "error",
|
|
91
|
+
"react/jsx-pascal-case": "error",
|
|
92
|
+
"react/no-unstable-nested-components": "error",
|
|
93
|
+
"react/no-unescaped-entities": "off",
|
|
94
|
+
"react/react-in-jsx-scope": "off",
|
|
95
|
+
"react/rules-of-hooks": "error",
|
|
96
|
+
"require-await": "off",
|
|
97
|
+
"typescript/adjacent-overload-signatures": "error",
|
|
98
|
+
"typescript/array-type": "error",
|
|
99
|
+
"typescript/ban-tslint-comment": "error",
|
|
100
|
+
"typescript/class-literal-property-style": "error",
|
|
101
|
+
"typescript/consistent-generic-constructors": "error",
|
|
102
|
+
"typescript/consistent-indexed-object-style": "error",
|
|
103
|
+
"typescript/consistent-type-assertions": "error",
|
|
104
|
+
"typescript/consistent-type-definitions": ["error", "type"],
|
|
105
|
+
"typescript/consistent-type-imports": ["error", {
|
|
106
|
+
fixStyle: "inline-type-imports",
|
|
107
|
+
prefer: "type-imports"
|
|
108
|
+
}],
|
|
109
|
+
"typescript/consistent-return": "off",
|
|
110
|
+
"typescript/dot-notation": "error",
|
|
111
|
+
"typescript/no-dynamic-delete": "error",
|
|
112
|
+
"typescript/no-empty-object-type": "error",
|
|
113
|
+
"typescript/no-explicit-any": "error",
|
|
114
|
+
"typescript/no-floating-promises": "error",
|
|
115
|
+
"typescript/no-inferrable-types": "error",
|
|
116
|
+
"typescript/no-invalid-void-type": "error",
|
|
117
|
+
"typescript/no-misused-promises": "error",
|
|
118
|
+
"typescript/no-namespace": "error",
|
|
119
|
+
"typescript/no-non-null-asserted-nullish-coalescing": "error",
|
|
120
|
+
"typescript/no-require-imports": "error",
|
|
121
|
+
"typescript/no-unnecessary-boolean-literal-compare": "error",
|
|
122
|
+
"typescript/no-unnecessary-condition": ["error", { allowConstantLoopConditions: true }],
|
|
123
|
+
"typescript/no-unnecessary-template-expression": "error",
|
|
124
|
+
"typescript/non-nullable-type-assertion-style": "error",
|
|
125
|
+
"typescript/prefer-as-const": "error",
|
|
126
|
+
"typescript/prefer-find": "error",
|
|
127
|
+
"typescript/prefer-for-of": "error",
|
|
128
|
+
"typescript/prefer-function-type": "error",
|
|
129
|
+
"typescript/prefer-literal-enum-member": "error",
|
|
130
|
+
"typescript/prefer-readonly-parameter-types": "off",
|
|
131
|
+
"typescript/prefer-reduce-type-parameter": "error",
|
|
132
|
+
"typescript/prefer-regexp-exec": "error",
|
|
133
|
+
"typescript/prefer-return-this-type": "error",
|
|
134
|
+
"typescript/prefer-string-starts-ends-with": "error",
|
|
135
|
+
"typescript/restrict-plus-operands": ["error", {
|
|
136
|
+
allowAny: false,
|
|
137
|
+
allowBoolean: false,
|
|
138
|
+
allowNullish: false,
|
|
139
|
+
allowNumberAndString: false,
|
|
140
|
+
allowRegExp: false
|
|
141
|
+
}],
|
|
142
|
+
"typescript/return-await": ["error", "error-handling-correctness-only"],
|
|
143
|
+
"typescript/strict-boolean-expressions": ["error", {
|
|
144
|
+
allowAny: false,
|
|
145
|
+
allowNullableBoolean: true,
|
|
146
|
+
allowNullableEnum: false,
|
|
147
|
+
allowNullableNumber: false,
|
|
148
|
+
allowNullableObject: true,
|
|
149
|
+
allowNullableString: false,
|
|
150
|
+
allowNumber: false,
|
|
151
|
+
allowString: false
|
|
152
|
+
}],
|
|
153
|
+
"typescript/switch-exhaustiveness-check": "error",
|
|
154
|
+
"typescript/unified-signatures": "error",
|
|
155
|
+
"typescript/use-unknown-in-catch-callback-variable": "error",
|
|
156
|
+
"unicode-bom": ["error", "never"],
|
|
157
|
+
"unicorn/consistent-function-scoping": "error",
|
|
158
|
+
"unicorn/no-negated-condition": "off",
|
|
159
|
+
"unicorn/no-useless-undefined": "off",
|
|
160
|
+
"unicorn/prefer-top-level-await": "off",
|
|
161
|
+
"vitest/no-conditional-in-test": "off"
|
|
162
|
+
},
|
|
163
|
+
settings: { react: { version: "19" } }
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
//#endregion
|
|
167
|
+
export { oxlintBaseConfig };
|