@4mbl/lint 0.0.0-beta.c4e49f3 → 0.0.0-beta.c65e34e
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 +116 -0
- package/README.md +50 -13
- package/bin/cli.js +25 -0
- package/package.json +11 -7
- package/src/base.ts +132 -0
- package/src/next.ts +75 -30
- package/src/node.ts +13 -0
- package/src/react.ts +74 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,121 @@
|
|
|
1
1
|
# @4mbl/lint
|
|
2
2
|
|
|
3
|
+
## 0.16.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 6878a35: Upgrade config dependencies
|
|
8
|
+
|
|
9
|
+
## 0.15.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 5040323: Upgrade config dependencies
|
|
14
|
+
|
|
15
|
+
## 0.14.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- 794dbfb: Upgrade config dependencies
|
|
20
|
+
- e6a08fd: Upgrade to ESLint 10
|
|
21
|
+
|
|
22
|
+
## 0.13.0
|
|
23
|
+
|
|
24
|
+
### Minor Changes
|
|
25
|
+
|
|
26
|
+
- ac23f1d: Upgrade config dependencies
|
|
27
|
+
|
|
28
|
+
## 0.12.0
|
|
29
|
+
|
|
30
|
+
### Minor Changes
|
|
31
|
+
|
|
32
|
+
- dd16619: Upgrade config dependencies
|
|
33
|
+
|
|
34
|
+
## 0.11.0
|
|
35
|
+
|
|
36
|
+
### Minor Changes
|
|
37
|
+
|
|
38
|
+
- e011cd6: Upgrade config dependencies
|
|
39
|
+
|
|
40
|
+
## 0.10.0
|
|
41
|
+
|
|
42
|
+
### Minor Changes
|
|
43
|
+
|
|
44
|
+
- 774cb2a: Upgrade config dependencies
|
|
45
|
+
|
|
46
|
+
## 0.9.0
|
|
47
|
+
|
|
48
|
+
### Minor Changes
|
|
49
|
+
|
|
50
|
+
- aee78b7: Upgrade config dependencies
|
|
51
|
+
|
|
52
|
+
## 0.8.0
|
|
53
|
+
|
|
54
|
+
### Minor Changes
|
|
55
|
+
|
|
56
|
+
- 152396b: Upgrade config dependencies
|
|
57
|
+
|
|
58
|
+
## 0.7.0
|
|
59
|
+
|
|
60
|
+
### Minor Changes
|
|
61
|
+
|
|
62
|
+
- 8e46d6b: Upgrade config dependencies
|
|
63
|
+
|
|
64
|
+
### Patch Changes
|
|
65
|
+
|
|
66
|
+
- 8e46d6b: Re-export types with type-keyword to fix verbatimModuleSyntax
|
|
67
|
+
|
|
68
|
+
## 0.6.0
|
|
69
|
+
|
|
70
|
+
### Minor Changes
|
|
71
|
+
|
|
72
|
+
- 46d0443: Upgrade config dependencies
|
|
73
|
+
|
|
74
|
+
## 0.5.0
|
|
75
|
+
|
|
76
|
+
### Minor Changes
|
|
77
|
+
|
|
78
|
+
- 55c3db6: Export `defineConfig` from eslint
|
|
79
|
+
- f7d30bb: Upgrade config dependencies
|
|
80
|
+
|
|
81
|
+
## 0.4.0
|
|
82
|
+
|
|
83
|
+
### Minor Changes
|
|
84
|
+
|
|
85
|
+
- 00cfefd: Add node template
|
|
86
|
+
|
|
87
|
+
## 0.3.2
|
|
88
|
+
|
|
89
|
+
### Patch Changes
|
|
90
|
+
|
|
91
|
+
- df1c48b: Re-export eslint Config type from react template
|
|
92
|
+
|
|
93
|
+
## 0.3.1
|
|
94
|
+
|
|
95
|
+
### Patch Changes
|
|
96
|
+
|
|
97
|
+
- d17fc69: Fix react template export
|
|
98
|
+
|
|
99
|
+
## 0.3.0
|
|
100
|
+
|
|
101
|
+
### Minor Changes
|
|
102
|
+
|
|
103
|
+
- 6d969e6: Add react template
|
|
104
|
+
- 6d969e6: Upgrade eslint and config dependencies
|
|
105
|
+
|
|
106
|
+
## 0.2.1
|
|
107
|
+
|
|
108
|
+
### Patch Changes
|
|
109
|
+
|
|
110
|
+
- 3a223fe: Use flat config version of eslint-plugin-react-hooks
|
|
111
|
+
|
|
112
|
+
## 0.2.0
|
|
113
|
+
|
|
114
|
+
### Minor Changes
|
|
115
|
+
|
|
116
|
+
- c4e49f3: Add eslint-plugin-react-hooks
|
|
117
|
+
- c4e49f3: Add eslint-config-prettier
|
|
118
|
+
|
|
3
119
|
## 0.1.1
|
|
4
120
|
|
|
5
121
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -2,40 +2,77 @@
|
|
|
2
2
|
|
|
3
3
|
> Linting configuration for various environments.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
- [Usage](#usage)
|
|
6
|
+
- [Running `lint` CLI wrapper](#running-lint-cli-wrapper)
|
|
7
|
+
- [Running `oxlint` directly](#running-oxlint-directly)
|
|
8
|
+
- [Available templates](#available-templates)
|
|
9
|
+
- [Versioning](#versioning)
|
|
8
10
|
|
|
9
11
|
---
|
|
10
12
|
|
|
13
|
+
> [!NOTE]
|
|
14
|
+
> This package currently uses [oxlint](https://www.npmjs.com/package/oxlint) as the underlying linting tool. That may change in a future major release.
|
|
15
|
+
|
|
11
16
|
## Usage
|
|
12
17
|
|
|
13
|
-
Install the [`@4mbl/lint`](https://www.npmjs.com/package/@4mbl/lint)
|
|
18
|
+
Install the [`@4mbl/lint`](https://www.npmjs.com/package/@4mbl/lint) package.
|
|
14
19
|
|
|
15
20
|
```shell
|
|
16
21
|
npm install -D @4mbl/lint
|
|
17
22
|
```
|
|
18
23
|
|
|
19
|
-
Create a `
|
|
24
|
+
Create a `oxlint.config.ts` file for your package. If you are using a monorepo, create a `oxlint.config.ts` for each package in the monorepo.
|
|
20
25
|
|
|
21
26
|
```js
|
|
22
|
-
import
|
|
27
|
+
import defineConfig from '@4mbl/lint/next'; // <-- change `next` to the desired template
|
|
28
|
+
|
|
29
|
+
export default defineConfig();
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Running `lint` CLI wrapper
|
|
33
|
+
|
|
34
|
+
This is the recommended way as it abstracts away the underlying linting package and allows us to change it in the future. While we try to keep the CLI wrapper interface stable between possible tooling changes, it is inevitable to have breaking changes if the underlying tooling changes.
|
|
23
35
|
|
|
24
|
-
|
|
36
|
+
Set a script that uses the linting CLI wrapper in your `package.json`. While it may be tempting to just call `lint` directly in CI or locally, it is recommended to use a script as it allows additional arguments to be passed to the CLI wrapper.
|
|
37
|
+
|
|
38
|
+
```shell
|
|
39
|
+
npm pkg set scripts.lint="lint"
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
The CLI wrapper uses the following default arguments:
|
|
43
|
+
|
|
44
|
+
- `--max-warnings=0`
|
|
45
|
+
- `--report-unused-disable-directives`
|
|
46
|
+
|
|
47
|
+
These arguments can be overridden by passing them explicitly to the CLI wrapper.
|
|
48
|
+
|
|
49
|
+
### Running `oxlint` directly
|
|
50
|
+
|
|
51
|
+
```shell
|
|
52
|
+
npm pkg set scripts.lint="oxlint src"
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
You may need to explicitly allow the underlying linting packages to be used by your scripts.
|
|
56
|
+
|
|
57
|
+
For example, when using pnpm, you need to set `publicHoistPattern` in your `pnpm-workspace.yaml`.
|
|
58
|
+
|
|
59
|
+
```yaml
|
|
60
|
+
publicHoistPattern:
|
|
61
|
+
- oxlint
|
|
25
62
|
```
|
|
26
63
|
|
|
27
64
|
## Available templates
|
|
28
65
|
|
|
29
|
-
|
|
66
|
+
These are the currently available config templates.
|
|
30
67
|
|
|
31
|
-
- **Next** -
|
|
68
|
+
- **Next** - Extending the Next.js linting config.
|
|
69
|
+
- **Node** - Linting configuration for Node.js.
|
|
70
|
+
- **React** - Extending the Vite-React linting config.
|
|
32
71
|
|
|
33
72
|
## Versioning
|
|
34
73
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
The package follows the following versioning scheme: `X.Y.Z`
|
|
74
|
+
The package follows the following versioning scheme: `X.Y.Z`.
|
|
38
75
|
|
|
39
|
-
- `X` - Reserved for linting provider changes as those might cause wider backwards
|
|
76
|
+
- `X` - Reserved for linting provider changes as those might cause wider backwards compatibility issues.
|
|
40
77
|
- `Y` - New linting rules. New rules are first added as warnings, and if error is preferred, the rule is promoted to produce errors in the next minor release.
|
|
41
78
|
- `Z` - Minor fixes that make the previous release unusable.
|
package/bin/cli.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { spawnSync } from 'node:child_process';
|
|
4
|
+
|
|
5
|
+
const args = process.argv.slice(2);
|
|
6
|
+
|
|
7
|
+
const hasPath = args.some((a) => !a.startsWith('-'));
|
|
8
|
+
const hasMaxWarn = args.some((a) => a.startsWith('--max-warnings'));
|
|
9
|
+
const hasReportUnused = args.some((a) =>
|
|
10
|
+
a.startsWith('--report-unused-disable-directives'),
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
const finalArgs = [
|
|
14
|
+
...(hasPath ? [] : ['src']),
|
|
15
|
+
...(hasMaxWarn ? [] : ['--max-warnings=0']),
|
|
16
|
+
...(hasReportUnused ? [] : ['--report-unused-disable-directives']),
|
|
17
|
+
...args,
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
const result = spawnSync('oxlint', finalArgs, {
|
|
21
|
+
stdio: 'inherit',
|
|
22
|
+
shell: true,
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
process.exit(result.status ?? 1);
|
package/package.json
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@4mbl/lint",
|
|
3
|
-
"version": "0.0.0-beta.
|
|
3
|
+
"version": "0.0.0-beta.c65e34e",
|
|
4
4
|
"description": "Linting configuration for various environments.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "4mbl",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"homepage": "https://github.com/4mbl/config/tree/main/packages/lint#readme",
|
|
9
9
|
"exports": {
|
|
10
|
-
"./next": "./src/next.ts"
|
|
10
|
+
"./next": "./src/next.ts",
|
|
11
|
+
"./node": "./src/node.ts",
|
|
12
|
+
"./react": "./src/react.ts"
|
|
13
|
+
},
|
|
14
|
+
"bin": {
|
|
15
|
+
"lint": "./bin/cli.js"
|
|
11
16
|
},
|
|
12
17
|
"files": [
|
|
13
18
|
"src",
|
|
@@ -24,14 +29,13 @@
|
|
|
24
29
|
"lint"
|
|
25
30
|
],
|
|
26
31
|
"dependencies": {
|
|
27
|
-
"@eslint/js": "^9.38.0",
|
|
28
|
-
"eslint": "^9.38.0",
|
|
29
|
-
"eslint-config-next": "^16.0.1",
|
|
30
|
-
"eslint-config-prettier": "^10.1.8",
|
|
31
32
|
"eslint-plugin-react-compiler": "19.1.0-rc.2",
|
|
32
33
|
"eslint-plugin-react-hooks": "^7.0.1",
|
|
34
|
+
"eslint-plugin-react-refresh": "^0.5.2",
|
|
35
|
+
"globals": "^17.4.0",
|
|
33
36
|
"jiti": "^2.6.1",
|
|
34
|
-
"
|
|
37
|
+
"oxlint": "^1.56.0",
|
|
38
|
+
"oxlint-tsgolint": "^0.17.0"
|
|
35
39
|
},
|
|
36
40
|
"scripts": {}
|
|
37
41
|
}
|
package/src/base.ts
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { defineConfig } from 'oxlint';
|
|
2
|
+
|
|
3
|
+
type BaseOptions = {
|
|
4
|
+
uiPath: string;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
// const DEFAULT_OPTIONS: BaseOptions = {};
|
|
8
|
+
|
|
9
|
+
export default function (_options?: Partial<BaseOptions>) {
|
|
10
|
+
// const opts = { ...DEFAULT_OPTIONS, ...options };
|
|
11
|
+
|
|
12
|
+
return defineConfig({
|
|
13
|
+
plugins: ['typescript', 'unicorn'],
|
|
14
|
+
jsPlugins: [],
|
|
15
|
+
categories: {
|
|
16
|
+
correctness: 'off',
|
|
17
|
+
},
|
|
18
|
+
env: {
|
|
19
|
+
builtin: true,
|
|
20
|
+
},
|
|
21
|
+
options: {
|
|
22
|
+
typeAware: true,
|
|
23
|
+
},
|
|
24
|
+
rules: {
|
|
25
|
+
'constructor-super': 'error',
|
|
26
|
+
'for-direction': 'error',
|
|
27
|
+
'getter-return': 'error',
|
|
28
|
+
'no-async-promise-executor': 'error',
|
|
29
|
+
'no-case-declarations': 'error',
|
|
30
|
+
'no-class-assign': 'error',
|
|
31
|
+
'no-compare-neg-zero': 'error',
|
|
32
|
+
'no-cond-assign': 'error',
|
|
33
|
+
'no-const-assign': 'error',
|
|
34
|
+
'no-constant-binary-expression': 'error',
|
|
35
|
+
'no-constant-condition': 'error',
|
|
36
|
+
'no-control-regex': 'error',
|
|
37
|
+
'no-debugger': 'error',
|
|
38
|
+
'no-delete-var': 'error',
|
|
39
|
+
'no-dupe-class-members': 'error',
|
|
40
|
+
'no-dupe-else-if': 'error',
|
|
41
|
+
'no-dupe-keys': 'error',
|
|
42
|
+
'no-duplicate-case': 'error',
|
|
43
|
+
'no-empty': 'error',
|
|
44
|
+
'no-empty-character-class': 'error',
|
|
45
|
+
'no-empty-pattern': 'error',
|
|
46
|
+
'no-empty-static-block': 'error',
|
|
47
|
+
'no-ex-assign': 'error',
|
|
48
|
+
'no-extra-boolean-cast': 'error',
|
|
49
|
+
'no-fallthrough': 'error',
|
|
50
|
+
'no-func-assign': 'error',
|
|
51
|
+
'no-global-assign': 'error',
|
|
52
|
+
'no-import-assign': 'error',
|
|
53
|
+
'no-invalid-regexp': 'error',
|
|
54
|
+
'no-irregular-whitespace': 'error',
|
|
55
|
+
'no-loss-of-precision': 'error',
|
|
56
|
+
'no-misleading-character-class': 'error',
|
|
57
|
+
'no-new-native-nonconstructor': 'error',
|
|
58
|
+
'no-nonoctal-decimal-escape': 'error',
|
|
59
|
+
'no-obj-calls': 'error',
|
|
60
|
+
'no-prototype-builtins': 'error',
|
|
61
|
+
'no-redeclare': 'error',
|
|
62
|
+
'no-regex-spaces': 'error',
|
|
63
|
+
'no-self-assign': 'error',
|
|
64
|
+
'no-setter-return': 'error',
|
|
65
|
+
'no-shadow-restricted-names': 'error',
|
|
66
|
+
'no-sparse-arrays': 'error',
|
|
67
|
+
'no-this-before-super': 'error',
|
|
68
|
+
'no-undef': 'error',
|
|
69
|
+
'no-unreachable': 'error',
|
|
70
|
+
'no-unsafe-finally': 'error',
|
|
71
|
+
'no-unsafe-negation': 'error',
|
|
72
|
+
'no-unsafe-optional-chaining': 'error',
|
|
73
|
+
'no-unused-labels': 'error',
|
|
74
|
+
'no-unused-private-class-members': 'error',
|
|
75
|
+
'no-unused-vars': 'warn',
|
|
76
|
+
'no-useless-backreference': 'error',
|
|
77
|
+
'no-useless-catch': 'error',
|
|
78
|
+
'no-useless-escape': 'error',
|
|
79
|
+
'no-with': 'error',
|
|
80
|
+
'require-yield': 'error',
|
|
81
|
+
'use-isnan': 'error',
|
|
82
|
+
'valid-typeof': 'error',
|
|
83
|
+
'@typescript-eslint/ban-ts-comment': 'error',
|
|
84
|
+
'no-array-constructor': 'error',
|
|
85
|
+
'@typescript-eslint/no-duplicate-enum-values': 'error',
|
|
86
|
+
'@typescript-eslint/no-empty-object-type': 'error',
|
|
87
|
+
'@typescript-eslint/no-explicit-any': 'error',
|
|
88
|
+
'@typescript-eslint/no-extra-non-null-assertion': 'error',
|
|
89
|
+
'@typescript-eslint/no-misused-new': 'error',
|
|
90
|
+
'@typescript-eslint/no-namespace': 'error',
|
|
91
|
+
'@typescript-eslint/no-non-null-asserted-optional-chain': 'error',
|
|
92
|
+
'@typescript-eslint/no-require-imports': 'error',
|
|
93
|
+
'@typescript-eslint/no-this-alias': 'error',
|
|
94
|
+
'@typescript-eslint/no-unnecessary-type-constraint': 'error',
|
|
95
|
+
'@typescript-eslint/no-unsafe-declaration-merging': 'error',
|
|
96
|
+
'@typescript-eslint/no-unsafe-function-type': 'error',
|
|
97
|
+
'no-unused-expressions': 'warn',
|
|
98
|
+
'@typescript-eslint/no-wrapper-object-types': 'error',
|
|
99
|
+
'@typescript-eslint/prefer-as-const': 'error',
|
|
100
|
+
'@typescript-eslint/prefer-namespace-keyword': 'error',
|
|
101
|
+
'@typescript-eslint/triple-slash-reference': 'error',
|
|
102
|
+
},
|
|
103
|
+
overrides: [
|
|
104
|
+
{
|
|
105
|
+
files: ['**/*.{ts,tsx,mts,cts}'],
|
|
106
|
+
rules: {
|
|
107
|
+
'constructor-super': 'off',
|
|
108
|
+
'getter-return': 'off',
|
|
109
|
+
'no-class-assign': 'off',
|
|
110
|
+
'no-const-assign': 'off',
|
|
111
|
+
'no-dupe-class-members': 'off',
|
|
112
|
+
'no-dupe-keys': 'off',
|
|
113
|
+
'no-func-assign': 'off',
|
|
114
|
+
'no-import-assign': 'off',
|
|
115
|
+
'no-new-native-nonconstructor': 'off',
|
|
116
|
+
'no-obj-calls': 'off',
|
|
117
|
+
'no-redeclare': 'off',
|
|
118
|
+
'no-setter-return': 'off',
|
|
119
|
+
'no-this-before-super': 'off',
|
|
120
|
+
'no-undef': 'off',
|
|
121
|
+
'no-unreachable': 'off',
|
|
122
|
+
'no-unsafe-negation': 'off',
|
|
123
|
+
'no-var': 'error',
|
|
124
|
+
'no-with': 'off',
|
|
125
|
+
'prefer-const': 'error',
|
|
126
|
+
'prefer-rest-params': 'error',
|
|
127
|
+
'prefer-spread': 'error',
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
],
|
|
131
|
+
});
|
|
132
|
+
}
|
package/src/next.ts
CHANGED
|
@@ -1,34 +1,79 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import nextTs from 'eslint-config-next/typescript';
|
|
5
|
-
import * as reactCompiler from 'eslint-plugin-react-compiler';
|
|
6
|
-
import { defineConfig, globalIgnores, Config } from 'eslint/config';
|
|
7
|
-
import tseslint from 'typescript-eslint';
|
|
8
|
-
import prettier from 'eslint-config-prettier/flat';
|
|
9
|
-
import reactHooks from 'eslint-plugin-react-hooks';
|
|
1
|
+
import { defineConfig } from 'oxlint';
|
|
2
|
+
import react, { type ReactOptions } from './react.ts';
|
|
3
|
+
import reactRefresh from 'eslint-plugin-react-refresh';
|
|
10
4
|
|
|
11
|
-
|
|
5
|
+
type NextOptions = ReactOptions & {
|
|
6
|
+
/**
|
|
7
|
+
* Sets the parent directory of UI components to ignore them in react-refresh.
|
|
8
|
+
* This allows multiple exports from the same file, which is common when using libraries like class-variance-authority.
|
|
9
|
+
*
|
|
10
|
+
* Set to `null` to disable react-refresh suppression for UI components.
|
|
11
|
+
*
|
|
12
|
+
* Defaults to `src/components/ui/`.
|
|
13
|
+
*/
|
|
14
|
+
uiPath: string | null;
|
|
15
|
+
};
|
|
12
16
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
{
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
...nextVitals,
|
|
24
|
-
...nextTs,
|
|
25
|
-
reactHooks.configs.recommended,
|
|
26
|
-
reactCompiler.configs.recommended,
|
|
27
|
-
{
|
|
17
|
+
const DEFAULT_OPTIONS: NextOptions = { uiPath: 'src/components/ui/' };
|
|
18
|
+
|
|
19
|
+
export default function (options?: Partial<NextOptions>) {
|
|
20
|
+
const opts = { ...DEFAULT_OPTIONS, ...options };
|
|
21
|
+
|
|
22
|
+
return defineConfig({
|
|
23
|
+
extends: [react(options)],
|
|
24
|
+
plugins: ['nextjs'],
|
|
28
25
|
rules: {
|
|
29
|
-
'
|
|
26
|
+
'@next/next/google-font-display': 'warn',
|
|
27
|
+
'@next/next/google-font-preconnect': 'warn',
|
|
28
|
+
'@next/next/next-script-for-ga': 'warn',
|
|
29
|
+
'@next/next/no-async-client-component': 'warn',
|
|
30
|
+
'@next/next/no-before-interactive-script-outside-document': 'warn',
|
|
31
|
+
'@next/next/no-css-tags': 'warn',
|
|
32
|
+
'@next/next/no-head-element': 'warn',
|
|
33
|
+
'@next/next/no-html-link-for-pages': 'error',
|
|
34
|
+
'@next/next/no-page-custom-font': 'warn',
|
|
35
|
+
'@next/next/no-styled-jsx-in-document': 'warn',
|
|
36
|
+
'@next/next/no-sync-scripts': 'error',
|
|
37
|
+
'@next/next/no-title-in-document-head': 'warn',
|
|
38
|
+
'@next/next/no-typos': 'warn',
|
|
39
|
+
'@next/next/no-unwanted-polyfillio': 'warn',
|
|
40
|
+
'@next/next/inline-script-id': 'error',
|
|
41
|
+
'@next/next/no-assign-module-variable': 'error',
|
|
42
|
+
'@next/next/no-document-import-in-page': 'error',
|
|
43
|
+
'@next/next/no-duplicate-head': 'error',
|
|
44
|
+
'@next/next/no-head-import-in-document': 'error',
|
|
45
|
+
'@next/next/no-script-component-in-head': 'error',
|
|
30
46
|
},
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
47
|
+
ignorePatterns: ['.next/**', 'out/**', 'build/**', 'next-env.d.ts'],
|
|
48
|
+
overrides: [
|
|
49
|
+
// ignores warnings for special exports in page and layout files
|
|
50
|
+
// https://github.com/ArnaudBarre/eslint-plugin-react-refresh?tab=readme-ov-file#next-config
|
|
51
|
+
{
|
|
52
|
+
files: ['**/*.{js,jsx,mjs,ts,tsx,mts,cts}'],
|
|
53
|
+
rules: {
|
|
54
|
+
'react-refresh-js/only-export-components': [
|
|
55
|
+
'error',
|
|
56
|
+
{
|
|
57
|
+
allowExportNames: (reactRefresh.configs.next.rules as any)[
|
|
58
|
+
'react-refresh/only-export-components'
|
|
59
|
+
][1]['allowExportNames'],
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
opts.uiPath === null
|
|
65
|
+
? { files: [], rules: {} }
|
|
66
|
+
: {
|
|
67
|
+
files: [
|
|
68
|
+
`${opts.uiPath}/**/*.{js,jsx,mjs,ts,tsx,mts,cts}`.replaceAll(
|
|
69
|
+
'//',
|
|
70
|
+
'/',
|
|
71
|
+
),
|
|
72
|
+
],
|
|
73
|
+
rules: {
|
|
74
|
+
'react-refresh-js/only-export-components': 'off',
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
});
|
|
79
|
+
}
|
package/src/node.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { defineConfig } from 'oxlint';
|
|
2
|
+
import base from './base.ts';
|
|
3
|
+
|
|
4
|
+
type NodeOptions = {};
|
|
5
|
+
|
|
6
|
+
// const DEFAULT_OPTIONS: NodeOptions = {};
|
|
7
|
+
|
|
8
|
+
export default function (_options?: Partial<NodeOptions>) {
|
|
9
|
+
// const opts = { ...DEFAULT_OPTIONS, ...options };
|
|
10
|
+
return defineConfig({
|
|
11
|
+
extends: [base()],
|
|
12
|
+
});
|
|
13
|
+
}
|
package/src/react.ts
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { defineConfig } from 'oxlint';
|
|
2
|
+
import base from './base.ts';
|
|
3
|
+
|
|
4
|
+
export type ReactOptions = {};
|
|
5
|
+
|
|
6
|
+
// const DEFAULT_OPTIONS: ReactOptions = {};
|
|
7
|
+
|
|
8
|
+
export default function (_options?: Partial<ReactOptions>) {
|
|
9
|
+
// const opts = { ...DEFAULT_OPTIONS, ...options };
|
|
10
|
+
|
|
11
|
+
return defineConfig({
|
|
12
|
+
extends: [base()],
|
|
13
|
+
plugins: ['react'],
|
|
14
|
+
jsPlugins: [
|
|
15
|
+
{ name: 'react-hooks-js', specifier: 'eslint-plugin-react-hooks' },
|
|
16
|
+
{ name: 'react-refresh-js', specifier: 'eslint-plugin-react-refresh' },
|
|
17
|
+
{ name: 'react-compiler-js', specifier: 'eslint-plugin-react-compiler' },
|
|
18
|
+
],
|
|
19
|
+
rules: {
|
|
20
|
+
'react-hooks-js/rules-of-hooks': 'error',
|
|
21
|
+
'react-hooks-js/exhaustive-deps': 'warn',
|
|
22
|
+
'react-hooks-js/set-state-in-effect': 'warn',
|
|
23
|
+
'react-refresh-js/only-export-components': 'error',
|
|
24
|
+
'react-compiler-js/react-compiler': 'error',
|
|
25
|
+
},
|
|
26
|
+
overrides: [
|
|
27
|
+
{
|
|
28
|
+
files: ['**/*.{js,jsx,mjs,ts,tsx,mts,cts}'],
|
|
29
|
+
rules: {
|
|
30
|
+
'react/display-name': 'error',
|
|
31
|
+
'react/jsx-key': 'error',
|
|
32
|
+
'react/jsx-no-comment-textnodes': 'error',
|
|
33
|
+
'react/jsx-no-duplicate-props': 'error',
|
|
34
|
+
'react/jsx-no-target-blank': 'off',
|
|
35
|
+
'react/jsx-no-undef': 'error',
|
|
36
|
+
'react/no-children-prop': 'error',
|
|
37
|
+
'react/no-danger-with-children': 'error',
|
|
38
|
+
// "react/no-deprecated": "error", // not implemented yet in oxlint
|
|
39
|
+
'react/no-direct-mutation-state': 'error',
|
|
40
|
+
'react/no-find-dom-node': 'error',
|
|
41
|
+
'react/no-is-mounted': 'error',
|
|
42
|
+
'react/no-render-return-value': 'error',
|
|
43
|
+
'react/no-string-refs': 'error',
|
|
44
|
+
'react/no-unescaped-entities': 'error',
|
|
45
|
+
'react/no-unknown-property': 'off',
|
|
46
|
+
'react/no-unsafe': 'off',
|
|
47
|
+
'react/react-in-jsx-scope': 'off',
|
|
48
|
+
'react/require-render-return': 'error',
|
|
49
|
+
'import/no-anonymous-default-export': 'warn',
|
|
50
|
+
'jsx-a11y/alt-text': ['warn', { elements: ['img'], img: ['Image'] }],
|
|
51
|
+
'jsx-a11y/aria-props': 'warn',
|
|
52
|
+
'jsx-a11y/aria-proptypes': 'warn',
|
|
53
|
+
'jsx-a11y/aria-unsupported-elements': 'warn',
|
|
54
|
+
'jsx-a11y/role-has-required-aria-props': 'warn',
|
|
55
|
+
'jsx-a11y/role-supports-aria-props': 'warn',
|
|
56
|
+
},
|
|
57
|
+
globals: {
|
|
58
|
+
AudioWorkletGlobalScope: 'readonly',
|
|
59
|
+
AudioWorkletProcessor: 'readonly',
|
|
60
|
+
currentFrame: 'readonly',
|
|
61
|
+
currentTime: 'readonly',
|
|
62
|
+
registerProcessor: 'readonly',
|
|
63
|
+
sampleRate: 'readonly',
|
|
64
|
+
WorkletGlobalScope: 'readonly',
|
|
65
|
+
},
|
|
66
|
+
plugins: ['import', 'jsx-a11y'],
|
|
67
|
+
env: {
|
|
68
|
+
browser: true,
|
|
69
|
+
node: true,
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
});
|
|
74
|
+
}
|