@nkzw/oxlint-config 0.0.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/LICENSE +21 -0
- package/README.md +54 -0
- package/oxlint.config.ts +243 -0
- package/package.json +41 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Nakazawa Tech
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# `@nkzw/oxlint-config`
|
|
2
|
+
|
|
3
|
+
Opinionated Oxlint config with sensible defaults.
|
|
4
|
+
|
|
5
|
+
## Installation & Usage
|
|
6
|
+
|
|
7
|
+
With Oxlint v1.46+:
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
npm install @nkzw/oxlint-config
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
In your `oxlint.config.ts`:
|
|
14
|
+
|
|
15
|
+
```js
|
|
16
|
+
import { defineConfig } from 'oxlint';
|
|
17
|
+
|
|
18
|
+
import nkzw from '@nkzw/oxlint-config';
|
|
19
|
+
|
|
20
|
+
export default defineConfig({
|
|
21
|
+
extends: [nkzw],
|
|
22
|
+
});
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Then run `pnpm oxlint` or `npm oxlint`.
|
|
26
|
+
|
|
27
|
+
## Philosophy & Principles
|
|
28
|
+
|
|
29
|
+
Use this configuration if these principles resonate with you:
|
|
30
|
+
|
|
31
|
+
- **Error, Never Warn:** Warnings are noise and get ignored. Either it's an issue, or it isn't. This config forces developers to fix problems or explicitly disable the rule with a comment.
|
|
32
|
+
- **Strict, Consistent Code Style:** When multiple approaches exist, this configuration enforces the strictest, most consistent code style, preferring modern language features and best practices.
|
|
33
|
+
- **Prevent Bugs:** Problematic patterns such as `instanceof` are not allowed, forcing developers to choose more robust patterns. Debug-only code such as `console.log` or `test.only` are disallowed to avoid unintended logging in production or accidental CI failures.
|
|
34
|
+
- **Fast:** Slow rules are avoided. For example, TypeScript's `noUnusedLocals` check is preferred over `no-unused-vars`.
|
|
35
|
+
- **Don't get in the way:** [Subjective or overly opinionated rules](https://github.com/airbnb/javascript) (e.g. style preferences) are disabled. Autofixable rules are preferred to reduce friction and save time.
|
|
36
|
+
|
|
37
|
+
## Included Plugins & Rules
|
|
38
|
+
|
|
39
|
+
This configuration consists of the most useful and least annoying rules from the following ESlint/Oxlint plugins:
|
|
40
|
+
|
|
41
|
+
- [`eslint-plugin-unicorn`](https://github.com/sindresorhus/eslint-plugin-unicorn)
|
|
42
|
+
- [`eslint-plugin-import-x`](https://github.com/un-ts/eslint-plugin-import-x)
|
|
43
|
+
- [`eslint-plugin-react`](https://github.com/jsx-eslint/eslint-plugin-react)
|
|
44
|
+
- [`eslint-plugin-react-hooks`](https://github.com/facebook/react/tree/main/packages/eslint-plugin-react-hooks)
|
|
45
|
+
- [`eslint-plugin-perfectionist`](https://perfectionist.dev/)
|
|
46
|
+
- [`eslint-plugin-no-instanceof`](https://www.npmjs.com/package/eslint-plugin-no-instanceof)
|
|
47
|
+
- [`eslint-plugin-no-only-tests`](https://github.com/levibuzolic/eslint-plugin-no-only-tests)
|
|
48
|
+
|
|
49
|
+
## Suggestions
|
|
50
|
+
|
|
51
|
+
This configuration is meant to be used with:
|
|
52
|
+
|
|
53
|
+
- [TypeScript](https://www.typescriptlang.org/) and the [`noUnusedLocals`](https://www.typescriptlang.org/tsconfig#noUnusedLocals) setting.
|
|
54
|
+
- [Oxfmt](https://oxc.rs/docs/guide/usage/formatter.html).
|
package/oxlint.config.ts
ADDED
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import { defineConfig } from 'oxlint';
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
categories: {
|
|
5
|
+
correctness: 'off',
|
|
6
|
+
},
|
|
7
|
+
env: {
|
|
8
|
+
browser: true,
|
|
9
|
+
builtin: true,
|
|
10
|
+
es2024: true,
|
|
11
|
+
node: true,
|
|
12
|
+
},
|
|
13
|
+
jsPlugins: [
|
|
14
|
+
'@nkzw/eslint-plugin',
|
|
15
|
+
'eslint-plugin-no-only-tests',
|
|
16
|
+
'eslint-plugin-perfectionist',
|
|
17
|
+
'eslint-plugin-unused-imports',
|
|
18
|
+
{ name: 'react-hooks-js', specifier: 'eslint-plugin-react-hooks' },
|
|
19
|
+
],
|
|
20
|
+
overrides: [
|
|
21
|
+
{
|
|
22
|
+
files: ['**/*.ts', '**/*.tsx', '**/*.mts', '**/*.cts'],
|
|
23
|
+
rules: {
|
|
24
|
+
'constructor-super': 'off',
|
|
25
|
+
'getter-return': 'off',
|
|
26
|
+
'no-class-assign': 'off',
|
|
27
|
+
'no-const-assign': 'off',
|
|
28
|
+
'no-dupe-class-members': 'off',
|
|
29
|
+
'no-dupe-keys': 'off',
|
|
30
|
+
'no-func-assign': 'off',
|
|
31
|
+
'no-import-assign': 'off',
|
|
32
|
+
'no-new-native-nonconstructor': 'off',
|
|
33
|
+
'no-obj-calls': 'off',
|
|
34
|
+
'no-redeclare': 'off',
|
|
35
|
+
'no-setter-return': 'off',
|
|
36
|
+
'no-this-before-super': 'off',
|
|
37
|
+
'no-undef': 'off',
|
|
38
|
+
'no-unreachable': 'off',
|
|
39
|
+
'no-unsafe-negation': 'off',
|
|
40
|
+
'no-with': 'off',
|
|
41
|
+
'prefer-rest-params': 'error',
|
|
42
|
+
'prefer-spread': 'error',
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
files: [
|
|
47
|
+
'server/scripts/**/*.tsx',
|
|
48
|
+
'server/src/app.tsx',
|
|
49
|
+
'server/src/index.tsx',
|
|
50
|
+
'server/src/prisma/seed.tsx',
|
|
51
|
+
'server/src/worker.tsx',
|
|
52
|
+
],
|
|
53
|
+
rules: {
|
|
54
|
+
'no-console': 'off',
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
files: ['server/**/*.tsx'],
|
|
59
|
+
rules: {
|
|
60
|
+
'react-hooks/rules-of-hooks': 'off',
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
plugins: ['typescript', 'import', 'react', 'unicorn'],
|
|
65
|
+
rules: {
|
|
66
|
+
'@nkzw/ensure-relay-types': 'error',
|
|
67
|
+
'@nkzw/no-instanceof': 'error',
|
|
68
|
+
'@nkzw/require-use-effect-arguments': 'error',
|
|
69
|
+
'@typescript-eslint/array-type': [
|
|
70
|
+
'error',
|
|
71
|
+
{
|
|
72
|
+
default: 'generic',
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
'@typescript-eslint/no-duplicate-enum-values': 'error',
|
|
76
|
+
'@typescript-eslint/no-empty-object-type': 'error',
|
|
77
|
+
'@typescript-eslint/no-explicit-any': 'error',
|
|
78
|
+
'@typescript-eslint/no-extra-non-null-assertion': 'error',
|
|
79
|
+
'@typescript-eslint/no-misused-new': 'error',
|
|
80
|
+
'@typescript-eslint/no-non-null-asserted-optional-chain': 'error',
|
|
81
|
+
'@typescript-eslint/no-require-imports': 'error',
|
|
82
|
+
'@typescript-eslint/no-unnecessary-type-constraint': 'error',
|
|
83
|
+
'@typescript-eslint/no-unsafe-declaration-merging': 'error',
|
|
84
|
+
'@typescript-eslint/no-unsafe-function-type': 'error',
|
|
85
|
+
'@typescript-eslint/no-wrapper-object-types': 'error',
|
|
86
|
+
'@typescript-eslint/prefer-as-const': 'error',
|
|
87
|
+
'@typescript-eslint/prefer-namespace-keyword': 'error',
|
|
88
|
+
'@typescript-eslint/triple-slash-reference': 'error',
|
|
89
|
+
'constructor-super': 'error',
|
|
90
|
+
curly: 'error',
|
|
91
|
+
'for-direction': 'error',
|
|
92
|
+
'getter-return': 'error',
|
|
93
|
+
'import-x/export': 'error',
|
|
94
|
+
'import-x/no-namespace': 'error',
|
|
95
|
+
'no-array-constructor': 'error',
|
|
96
|
+
'no-async-promise-executor': 'error',
|
|
97
|
+
'no-case-declarations': 'error',
|
|
98
|
+
'no-class-assign': 'error',
|
|
99
|
+
'no-compare-neg-zero': 'error',
|
|
100
|
+
'no-cond-assign': 'error',
|
|
101
|
+
'no-console': 'error',
|
|
102
|
+
'no-const-assign': 'error',
|
|
103
|
+
'no-constant-binary-expression': 'error',
|
|
104
|
+
'no-constant-condition': 'error',
|
|
105
|
+
'no-control-regex': 'error',
|
|
106
|
+
'no-debugger': 'error',
|
|
107
|
+
'no-delete-var': 'error',
|
|
108
|
+
'no-dupe-class-members': 'error',
|
|
109
|
+
'no-dupe-else-if': 'error',
|
|
110
|
+
'no-dupe-keys': 'error',
|
|
111
|
+
'no-duplicate-case': 'error',
|
|
112
|
+
'no-empty': 'error',
|
|
113
|
+
'no-empty-character-class': 'error',
|
|
114
|
+
'no-empty-pattern': 'error',
|
|
115
|
+
'no-empty-static-block': 'error',
|
|
116
|
+
'no-ex-assign': 'error',
|
|
117
|
+
'no-extra-boolean-cast': 'error',
|
|
118
|
+
'no-fallthrough': 'error',
|
|
119
|
+
'no-func-assign': 'error',
|
|
120
|
+
'no-global-assign': 'error',
|
|
121
|
+
'no-import-assign': 'error',
|
|
122
|
+
'no-invalid-regexp': 'error',
|
|
123
|
+
'no-irregular-whitespace': 'error',
|
|
124
|
+
'no-loss-of-precision': 'error',
|
|
125
|
+
'no-misleading-character-class': 'error',
|
|
126
|
+
'no-new-native-nonconstructor': 'error',
|
|
127
|
+
'no-nonoctal-decimal-escape': 'error',
|
|
128
|
+
'no-obj-calls': 'error',
|
|
129
|
+
'no-only-tests/no-only-tests': 'error',
|
|
130
|
+
'no-prototype-builtins': 'error',
|
|
131
|
+
'no-redeclare': 'error',
|
|
132
|
+
'no-regex-spaces': 'error',
|
|
133
|
+
'no-self-assign': 'error',
|
|
134
|
+
'no-setter-return': 'error',
|
|
135
|
+
'no-shadow-restricted-names': 'error',
|
|
136
|
+
'no-sparse-arrays': 'error',
|
|
137
|
+
'no-this-before-super': 'error',
|
|
138
|
+
'no-undef': 'error',
|
|
139
|
+
'no-unexpected-multiline': 'error',
|
|
140
|
+
'no-unreachable': 'error',
|
|
141
|
+
'no-unsafe-finally': 'error',
|
|
142
|
+
'no-unsafe-negation': 'error',
|
|
143
|
+
'no-unsafe-optional-chaining': 'error',
|
|
144
|
+
'no-unused-expressions': 'error',
|
|
145
|
+
'no-unused-labels': 'error',
|
|
146
|
+
'no-unused-private-class-members': 'error',
|
|
147
|
+
'no-useless-backreference': 'error',
|
|
148
|
+
'no-useless-catch': 'error',
|
|
149
|
+
'no-useless-escape': 'error',
|
|
150
|
+
'no-useless-rename': 'error',
|
|
151
|
+
'no-var': 'error',
|
|
152
|
+
'no-warning-comments': [
|
|
153
|
+
'error',
|
|
154
|
+
{
|
|
155
|
+
terms: ['@nocommit'],
|
|
156
|
+
},
|
|
157
|
+
],
|
|
158
|
+
'no-with': 'error',
|
|
159
|
+
'perfectionist/sort-enums': [
|
|
160
|
+
'error',
|
|
161
|
+
{
|
|
162
|
+
partitionByComment: true,
|
|
163
|
+
sortByValue: 'always',
|
|
164
|
+
},
|
|
165
|
+
],
|
|
166
|
+
'perfectionist/sort-heritage-clauses': 'error',
|
|
167
|
+
'perfectionist/sort-interfaces': 'error',
|
|
168
|
+
'perfectionist/sort-jsx-props': 'error',
|
|
169
|
+
'perfectionist/sort-object-types': 'error',
|
|
170
|
+
'perfectionist/sort-objects': [
|
|
171
|
+
'error',
|
|
172
|
+
{
|
|
173
|
+
partitionByComment: true,
|
|
174
|
+
},
|
|
175
|
+
],
|
|
176
|
+
'prefer-const': 'error',
|
|
177
|
+
'react-hooks-js/component-hook-factories': 'error',
|
|
178
|
+
'react-hooks-js/config': 'error',
|
|
179
|
+
'react-hooks-js/error-boundaries': 'error',
|
|
180
|
+
'react-hooks-js/gating': 'error',
|
|
181
|
+
'react-hooks-js/globals': 'error',
|
|
182
|
+
'react-hooks-js/immutability': 'error',
|
|
183
|
+
'react-hooks-js/incompatible-library': 'error',
|
|
184
|
+
'react-hooks-js/preserve-manual-memoization': 'error',
|
|
185
|
+
'react-hooks-js/purity': 'error',
|
|
186
|
+
'react-hooks-js/refs': 'error',
|
|
187
|
+
'react-hooks-js/set-state-in-effect': 'error',
|
|
188
|
+
'react-hooks-js/set-state-in-render': 'error',
|
|
189
|
+
'react-hooks-js/static-components': 'error',
|
|
190
|
+
'react-hooks-js/unsupported-syntax': 'error',
|
|
191
|
+
'react-hooks-js/use-memo': 'error',
|
|
192
|
+
'react-hooks/exhaustive-deps': 'error',
|
|
193
|
+
'react-hooks/rules-of-hooks': 'error',
|
|
194
|
+
'react/display-name': 'error',
|
|
195
|
+
'react/jsx-key': 'error',
|
|
196
|
+
'react/jsx-no-comment-textnodes': 'error',
|
|
197
|
+
'react/jsx-no-duplicate-props': 'error',
|
|
198
|
+
'react/jsx-no-target-blank': 'error',
|
|
199
|
+
'react/jsx-no-undef': 'error',
|
|
200
|
+
'react/no-children-prop': 'error',
|
|
201
|
+
'react/no-danger-with-children': 'error',
|
|
202
|
+
'react/no-direct-mutation-state': 'error',
|
|
203
|
+
'react/no-find-dom-node': 'error',
|
|
204
|
+
'react/no-is-mounted': 'error',
|
|
205
|
+
'react/no-render-return-value': 'error',
|
|
206
|
+
'react/no-string-refs': 'error',
|
|
207
|
+
'react/no-unescaped-entities': 'error',
|
|
208
|
+
'react/no-unknown-property': 'error',
|
|
209
|
+
'react/require-render-return': 'error',
|
|
210
|
+
'require-yield': 'error',
|
|
211
|
+
'unicorn/catch-error-name': 'error',
|
|
212
|
+
'unicorn/consistent-empty-array-spread': 'error',
|
|
213
|
+
'unicorn/consistent-function-scoping': 'error',
|
|
214
|
+
'unicorn/no-abusive-eslint-disable': 'error',
|
|
215
|
+
'unicorn/no-hex-escape': 'error',
|
|
216
|
+
'unicorn/no-invalid-fetch-options': 'error',
|
|
217
|
+
'unicorn/no-magic-array-flat-depth': 'error',
|
|
218
|
+
'unicorn/no-typeof-undefined': 'error',
|
|
219
|
+
'unicorn/no-unnecessary-slice-end': 'error',
|
|
220
|
+
'unicorn/no-useless-promise-resolve-reject': 'error',
|
|
221
|
+
'unicorn/no-useless-spread': 'error',
|
|
222
|
+
'unicorn/numeric-separators-style': 'error',
|
|
223
|
+
'unicorn/prefer-array-flat-map': 'error',
|
|
224
|
+
'unicorn/prefer-array-index-of': 'error',
|
|
225
|
+
'unicorn/prefer-array-some': 'error',
|
|
226
|
+
'unicorn/prefer-at': 'error',
|
|
227
|
+
'unicorn/prefer-dom-node-append': 'error',
|
|
228
|
+
'unicorn/prefer-native-coercion-functions': 'error',
|
|
229
|
+
'unicorn/prefer-node-protocol': 'error',
|
|
230
|
+
'unicorn/prefer-number-properties': 'error',
|
|
231
|
+
'unicorn/prefer-optional-catch-binding': 'error',
|
|
232
|
+
'unicorn/prefer-set-size': 'error',
|
|
233
|
+
'unicorn/prefer-string-raw': 'error',
|
|
234
|
+
'unicorn/prefer-string-replace-all': 'error',
|
|
235
|
+
'unicorn/prefer-string-slice': 'error',
|
|
236
|
+
'unicorn/prefer-structured-clone': 'error',
|
|
237
|
+
'unicorn/prefer-top-level-await': 'error',
|
|
238
|
+
'unicorn/text-encoding-identifier-case': 'error',
|
|
239
|
+
'unused-imports/no-unused-imports': 'error',
|
|
240
|
+
'use-isnan': 'error',
|
|
241
|
+
'valid-typeof': 'error',
|
|
242
|
+
},
|
|
243
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nkzw/oxlint-config",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Oxlint config with sensible defaults.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"autofix",
|
|
7
|
+
"config",
|
|
8
|
+
"defaults",
|
|
9
|
+
"oxlint",
|
|
10
|
+
"strict"
|
|
11
|
+
],
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"author": "Christoph Nakazawa <christoph.pojer@gmail.com>",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git://github.com/nkzw-tech/oxlint-config.git"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"oxlint.config.ts"
|
|
20
|
+
],
|
|
21
|
+
"type": "module",
|
|
22
|
+
"main": "oxlint.config.ts",
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@nkzw/eslint-plugin": "^2.0.0",
|
|
25
|
+
"eslint-plugin-no-only-tests": "^3.3.0",
|
|
26
|
+
"eslint-plugin-perfectionist": "^5.5.0",
|
|
27
|
+
"eslint-plugin-react-hooks": "^7.0.1",
|
|
28
|
+
"eslint-plugin-unused-imports": "~4.4.1"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"oxfmt": "^0.31.0",
|
|
32
|
+
"oxlint": "^1.46.0"
|
|
33
|
+
},
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"oxlint": ">=1.46.0"
|
|
36
|
+
},
|
|
37
|
+
"scripts": {
|
|
38
|
+
"format": "oxfmt --write .",
|
|
39
|
+
"lint": "oxlint ."
|
|
40
|
+
}
|
|
41
|
+
}
|