@philipseo/oxlint-config 0.0.0-stage → 0.0.0
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 +40 -2
- package/base.js +148 -0
- package/package.json +30 -4
- package/react.js +35 -0
package/README.md
CHANGED
|
@@ -1,3 +1,41 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @philipseo/oxlint-config
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Shared [Oxlint](https://oxc.rs/docs/guide/usage/linter) configs with type-aware
|
|
4
|
+
rules turned on.
|
|
5
|
+
|
|
6
|
+
## Install
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
pnpm add -D @philipseo/oxlint-config oxlint oxlint-tsgolint
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
`oxlint-tsgolint` runs the type-aware rules. It reads the nearest
|
|
13
|
+
`tsconfig.json`, which must not use `baseUrl`.
|
|
14
|
+
|
|
15
|
+
## Presets
|
|
16
|
+
|
|
17
|
+
- `base` — ESLint recommended and typescript-eslint `recommended` +
|
|
18
|
+
`recommended-type-checked` rules
|
|
19
|
+
- `react` — `base` plus React hooks, React Compiler and React Refresh (Vite)
|
|
20
|
+
rules
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
// oxlint.config.ts
|
|
26
|
+
import base from '@philipseo/oxlint-config/base';
|
|
27
|
+
import { defineConfig } from 'oxlint';
|
|
28
|
+
|
|
29
|
+
export default defineConfig({
|
|
30
|
+
extends: [base],
|
|
31
|
+
});
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Use `@philipseo/oxlint-config/react` the same way.
|
|
35
|
+
|
|
36
|
+
## Differences from the ESLint presets in `@philipseo/configs`
|
|
37
|
+
|
|
38
|
+
- Type-aware rules (for example `no-floating-promises`) are on.
|
|
39
|
+
- `react-hooks/config` and `react-hooks/gating` are not available in Oxlint.
|
|
40
|
+
- `no-undef` is off because Oxlint still marks it experimental.
|
|
41
|
+
- The `nest` preset is gone. It only added Jest and Node globals; use `base`.
|
package/base.js
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { defineConfig } from 'oxlint';
|
|
2
|
+
|
|
3
|
+
const typeScriptFiles = ['**/*.{ts,tsx,mts,cts}'];
|
|
4
|
+
|
|
5
|
+
export default defineConfig({
|
|
6
|
+
plugins: ['eslint', 'typescript'],
|
|
7
|
+
categories: {
|
|
8
|
+
correctness: 'off',
|
|
9
|
+
},
|
|
10
|
+
options: {
|
|
11
|
+
typeAware: true,
|
|
12
|
+
},
|
|
13
|
+
rules: {
|
|
14
|
+
'constructor-super': 'error',
|
|
15
|
+
'for-direction': 'error',
|
|
16
|
+
'getter-return': 'error',
|
|
17
|
+
'no-array-constructor': 'error',
|
|
18
|
+
'no-async-promise-executor': 'error',
|
|
19
|
+
'no-case-declarations': 'error',
|
|
20
|
+
'no-class-assign': 'error',
|
|
21
|
+
'no-compare-neg-zero': 'error',
|
|
22
|
+
'no-cond-assign': 'error',
|
|
23
|
+
'no-const-assign': 'error',
|
|
24
|
+
'no-constant-binary-expression': 'error',
|
|
25
|
+
'no-constant-condition': 'error',
|
|
26
|
+
'no-control-regex': 'error',
|
|
27
|
+
'no-debugger': 'error',
|
|
28
|
+
'no-delete-var': 'error',
|
|
29
|
+
'no-dupe-class-members': 'error',
|
|
30
|
+
'no-dupe-else-if': 'error',
|
|
31
|
+
'no-dupe-keys': 'error',
|
|
32
|
+
'no-duplicate-case': 'error',
|
|
33
|
+
'no-empty': 'error',
|
|
34
|
+
'no-empty-character-class': 'error',
|
|
35
|
+
'no-empty-pattern': 'error',
|
|
36
|
+
'no-empty-static-block': 'error',
|
|
37
|
+
'no-ex-assign': 'error',
|
|
38
|
+
'no-extra-boolean-cast': 'error',
|
|
39
|
+
'no-fallthrough': 'error',
|
|
40
|
+
'no-func-assign': 'error',
|
|
41
|
+
'no-global-assign': 'error',
|
|
42
|
+
'no-import-assign': 'error',
|
|
43
|
+
'no-invalid-regexp': 'error',
|
|
44
|
+
'no-irregular-whitespace': 'error',
|
|
45
|
+
'no-loss-of-precision': 'error',
|
|
46
|
+
'no-misleading-character-class': 'error',
|
|
47
|
+
'no-new-native-nonconstructor': 'error',
|
|
48
|
+
'no-nonoctal-decimal-escape': 'error',
|
|
49
|
+
'no-obj-calls': 'error',
|
|
50
|
+
'no-prototype-builtins': 'error',
|
|
51
|
+
'no-redeclare': 'error',
|
|
52
|
+
'no-regex-spaces': 'error',
|
|
53
|
+
'no-self-assign': 'error',
|
|
54
|
+
'no-setter-return': 'error',
|
|
55
|
+
'no-shadow-restricted-names': 'error',
|
|
56
|
+
'no-sparse-arrays': 'error',
|
|
57
|
+
'no-this-before-super': 'error',
|
|
58
|
+
'no-unassigned-vars': 'error',
|
|
59
|
+
'no-unreachable': 'error',
|
|
60
|
+
'no-unsafe-finally': 'error',
|
|
61
|
+
'no-unsafe-negation': 'error',
|
|
62
|
+
'no-unsafe-optional-chaining': 'error',
|
|
63
|
+
'no-unused-expressions': 'error',
|
|
64
|
+
'no-unused-labels': 'error',
|
|
65
|
+
'no-unused-private-class-members': 'error',
|
|
66
|
+
'no-unused-vars': [
|
|
67
|
+
'error',
|
|
68
|
+
{ argsIgnorePattern: '^_', caughtErrorsIgnorePattern: '^_' },
|
|
69
|
+
],
|
|
70
|
+
'no-useless-assignment': 'error',
|
|
71
|
+
'no-useless-backreference': 'error',
|
|
72
|
+
'no-useless-catch': 'error',
|
|
73
|
+
'no-useless-escape': 'error',
|
|
74
|
+
'no-with': 'error',
|
|
75
|
+
'preserve-caught-error': 'error',
|
|
76
|
+
'require-yield': 'error',
|
|
77
|
+
'use-isnan': 'error',
|
|
78
|
+
'valid-typeof': 'error',
|
|
79
|
+
'typescript/ban-ts-comment': 'error',
|
|
80
|
+
'typescript/no-duplicate-enum-values': 'error',
|
|
81
|
+
'typescript/no-empty-object-type': 'error',
|
|
82
|
+
'typescript/no-explicit-any': 'error',
|
|
83
|
+
'typescript/no-extra-non-null-assertion': 'error',
|
|
84
|
+
'typescript/no-misused-new': 'error',
|
|
85
|
+
'typescript/no-namespace': 'error',
|
|
86
|
+
'typescript/no-non-null-asserted-optional-chain': 'error',
|
|
87
|
+
'typescript/no-require-imports': 'error',
|
|
88
|
+
'typescript/no-this-alias': 'error',
|
|
89
|
+
'typescript/no-unnecessary-type-constraint': 'error',
|
|
90
|
+
'typescript/no-unsafe-declaration-merging': 'error',
|
|
91
|
+
'typescript/no-unsafe-function-type': 'error',
|
|
92
|
+
'typescript/no-wrapper-object-types': 'error',
|
|
93
|
+
'typescript/prefer-as-const': 'error',
|
|
94
|
+
'typescript/prefer-namespace-keyword': 'error',
|
|
95
|
+
'typescript/triple-slash-reference': 'error',
|
|
96
|
+
},
|
|
97
|
+
overrides: [
|
|
98
|
+
{
|
|
99
|
+
files: typeScriptFiles,
|
|
100
|
+
rules: {
|
|
101
|
+
// TypeScript 컴파일러가 이미 오류로 잡고, 함수 오버로드나 같은 이름의 타입·값을 중복 선언으로 잘못 잡는다
|
|
102
|
+
'constructor-super': 'off',
|
|
103
|
+
'getter-return': 'off',
|
|
104
|
+
'no-class-assign': 'off',
|
|
105
|
+
'no-const-assign': 'off',
|
|
106
|
+
'no-dupe-class-members': 'off',
|
|
107
|
+
'no-dupe-keys': 'off',
|
|
108
|
+
'no-func-assign': 'off',
|
|
109
|
+
'no-import-assign': 'off',
|
|
110
|
+
'no-new-native-nonconstructor': 'off',
|
|
111
|
+
'no-obj-calls': 'off',
|
|
112
|
+
'no-redeclare': 'off',
|
|
113
|
+
'no-setter-return': 'off',
|
|
114
|
+
'no-this-before-super': 'off',
|
|
115
|
+
'no-unreachable': 'off',
|
|
116
|
+
'no-unsafe-negation': 'off',
|
|
117
|
+
'no-with': 'off',
|
|
118
|
+
'no-var': 'error',
|
|
119
|
+
'prefer-const': 'error',
|
|
120
|
+
'prefer-rest-params': 'error',
|
|
121
|
+
'prefer-spread': 'error',
|
|
122
|
+
'typescript/await-thenable': 'error',
|
|
123
|
+
'typescript/no-array-delete': 'error',
|
|
124
|
+
'typescript/no-base-to-string': 'error',
|
|
125
|
+
'typescript/no-duplicate-type-constituents': 'error',
|
|
126
|
+
'typescript/no-floating-promises': 'error',
|
|
127
|
+
'typescript/no-for-in-array': 'error',
|
|
128
|
+
'typescript/no-implied-eval': 'error',
|
|
129
|
+
'typescript/no-misused-promises': 'error',
|
|
130
|
+
'typescript/no-redundant-type-constituents': 'error',
|
|
131
|
+
'typescript/no-unnecessary-type-assertion': 'error',
|
|
132
|
+
'typescript/no-unsafe-argument': 'error',
|
|
133
|
+
'typescript/no-unsafe-assignment': 'error',
|
|
134
|
+
'typescript/no-unsafe-call': 'error',
|
|
135
|
+
'typescript/no-unsafe-enum-comparison': 'error',
|
|
136
|
+
'typescript/no-unsafe-member-access': 'error',
|
|
137
|
+
'typescript/no-unsafe-return': 'error',
|
|
138
|
+
'typescript/no-unsafe-unary-minus': 'error',
|
|
139
|
+
'typescript/only-throw-error': 'error',
|
|
140
|
+
'typescript/prefer-promise-reject-errors': 'error',
|
|
141
|
+
'typescript/require-await': 'error',
|
|
142
|
+
'typescript/restrict-plus-operands': 'error',
|
|
143
|
+
'typescript/restrict-template-expressions': 'error',
|
|
144
|
+
'typescript/unbound-method': 'error',
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
],
|
|
148
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@philipseo/oxlint-config",
|
|
3
|
-
"version": "0.0.0
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Philip Seo <hbnb7894@gmail.com>",
|
|
7
|
+
"homepage": "https://github.com/philipseo/toolkit",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/philipseo/toolkit",
|
|
11
|
+
"directory": "packages/oxlint-config"
|
|
12
|
+
},
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"access": "public"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"oxlint",
|
|
18
|
+
"oxlint-config"
|
|
19
|
+
],
|
|
20
|
+
"files": [
|
|
21
|
+
"base.js",
|
|
22
|
+
"react.js"
|
|
23
|
+
],
|
|
24
|
+
"exports": {
|
|
25
|
+
"./base": "./base.js",
|
|
26
|
+
"./react": "./react.js"
|
|
27
|
+
},
|
|
28
|
+
"peerDependencies": {
|
|
29
|
+
"oxlint": "^1.95.0",
|
|
30
|
+
"oxlint-tsgolint": "^7.0.2009"
|
|
31
|
+
}
|
|
32
|
+
}
|
package/react.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { defineConfig } from 'oxlint';
|
|
2
|
+
|
|
3
|
+
import base from './base.js';
|
|
4
|
+
|
|
5
|
+
export default defineConfig({
|
|
6
|
+
extends: [base],
|
|
7
|
+
plugins: ['eslint', 'typescript', 'react'],
|
|
8
|
+
rules: {
|
|
9
|
+
'react/error-boundaries': 'error',
|
|
10
|
+
'react/exhaustive-deps': 'warn',
|
|
11
|
+
'react/globals': 'error',
|
|
12
|
+
'react/immutability': 'error',
|
|
13
|
+
'react/incompatible-library': 'warn',
|
|
14
|
+
'react/only-export-components': [
|
|
15
|
+
'error',
|
|
16
|
+
{ allowConstantExport: true, allowCompoundComponents: true },
|
|
17
|
+
],
|
|
18
|
+
'react/preserve-manual-memoization': 'error',
|
|
19
|
+
'react/purity': 'error',
|
|
20
|
+
'react/refs': 'error',
|
|
21
|
+
'react/rules-of-hooks': 'error',
|
|
22
|
+
'react/set-state-in-effect': 'error',
|
|
23
|
+
'react/set-state-in-render': 'error',
|
|
24
|
+
'react/static-components': 'error',
|
|
25
|
+
'react/unsupported-syntax': 'warn',
|
|
26
|
+
'react/use-memo': 'error',
|
|
27
|
+
},
|
|
28
|
+
overrides: [
|
|
29
|
+
{
|
|
30
|
+
// 최상위 env는 extends로 물려받지 않아 overrides에 둔다
|
|
31
|
+
files: ['**/*'],
|
|
32
|
+
env: { browser: true },
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
});
|