@ts-items/oxlint-config 0.0.0-stage → 0.0.1-alpha.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 +44 -2
- package/dist/configurations/baseConfig/baseConfig.d.ts +38 -0
- package/dist/configurations/baseConfig/baseConfig.js +43 -0
- package/dist/configurations/baseConfig/rules/eslintRules/eslintRules.d.ts +16 -0
- package/dist/configurations/baseConfig/rules/eslintRules/eslintRules.js +40 -0
- package/dist/configurations/baseConfig/rules/typescriptRules/typescriptRules.d.ts +1 -0
- package/dist/configurations/baseConfig/rules/typescriptRules/typescriptRules.js +6 -0
- package/dist/configurations/baseConfig/rules/unicornRules/unicornRules.d.ts +1 -0
- package/dist/configurations/baseConfig/rules/unicornRules/unicornRules.js +6 -0
- package/dist/configurations/index.d.ts +2 -0
- package/dist/configurations/index.js +2 -0
- package/dist/configurations/reactConfig/reactConfig.d.ts +58 -0
- package/dist/configurations/reactConfig/reactConfig.js +25 -0
- package/dist/utilities/withRulePrefix/withRulePrefix.d.ts +1 -0
- package/dist/utilities/withRulePrefix/withRulePrefix.js +7 -0
- package/package.json +60 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) akky-xxxx
|
|
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
CHANGED
|
@@ -1,3 +1,45 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @ts-items/oxlint-config
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## How to install
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
npm i -D @ts-items/oxlint-config oxlint
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
To enable type-aware linting (`typeAware: true`), also install `oxlint-tsgolint`:
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
npm i -D oxlint-tsgolint
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## How to use
|
|
16
|
+
|
|
17
|
+
Create `oxlint.config.mts`:
|
|
18
|
+
|
|
19
|
+
### For TypeScript projects
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
import { baseConfig } from "@ts-items/oxlint-config"
|
|
23
|
+
import { defineConfig } from "oxlint"
|
|
24
|
+
|
|
25
|
+
export default defineConfig({
|
|
26
|
+
extends: [baseConfig],
|
|
27
|
+
options: {
|
|
28
|
+
typeAware: true, // Optional but recommended. Requires `oxlint-tsgolint`
|
|
29
|
+
},
|
|
30
|
+
})
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### For React + TypeScript projects
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
import { reactConfig } from "@ts-items/oxlint-config"
|
|
37
|
+
import { defineConfig } from "oxlint"
|
|
38
|
+
|
|
39
|
+
export default defineConfig({
|
|
40
|
+
extends: [reactConfig],
|
|
41
|
+
options: {
|
|
42
|
+
typeAware: true, // Optional but recommended. Requires `oxlint-tsgolint`
|
|
43
|
+
},
|
|
44
|
+
})
|
|
45
|
+
```
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export declare const baseConfig: {
|
|
2
|
+
categories: {
|
|
3
|
+
correctness: "error";
|
|
4
|
+
nursery: "off";
|
|
5
|
+
pedantic: "error";
|
|
6
|
+
perf: "error";
|
|
7
|
+
restriction: "error";
|
|
8
|
+
style: "error";
|
|
9
|
+
suspicious: "error";
|
|
10
|
+
};
|
|
11
|
+
plugins: ("eslint" | "unicorn" | "oxc" | "import")[];
|
|
12
|
+
rules: {
|
|
13
|
+
"explicit-function-return-type": "off";
|
|
14
|
+
"explicit-module-boundary-types": "off";
|
|
15
|
+
"exports-last": "off";
|
|
16
|
+
"filename-case": "off";
|
|
17
|
+
"group-exports": "off";
|
|
18
|
+
"import/consistent-type-specifier-style": ["error", "prefer-top-level"];
|
|
19
|
+
"import/no-relative-parent-imports": "off";
|
|
20
|
+
"no-duplicate-imports": ["error", {
|
|
21
|
+
allowSeparateTypeImports: true;
|
|
22
|
+
}];
|
|
23
|
+
"no-inline-comments": "off";
|
|
24
|
+
"no-named-export": "off";
|
|
25
|
+
"no-nested-ternary": "error";
|
|
26
|
+
"no-null": "off";
|
|
27
|
+
"no-rest-spread-properties": "off";
|
|
28
|
+
"no-ternary": "off";
|
|
29
|
+
"no-undefined": "off";
|
|
30
|
+
"no-unneeded-ternary": "error";
|
|
31
|
+
"no-warning-comments": "off";
|
|
32
|
+
"one-var": "off";
|
|
33
|
+
"oxc/no-async-await": "off";
|
|
34
|
+
"oxc/no-optional-chaining": "off";
|
|
35
|
+
"prefer-default-export": "off";
|
|
36
|
+
"sort-imports": "off";
|
|
37
|
+
};
|
|
38
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { defineConfig } from "oxlint";
|
|
2
|
+
import { eslintRules } from "./rules/eslintRules/eslintRules.js";
|
|
3
|
+
import { typescriptRules } from "./rules/typescriptRules/typescriptRules.js";
|
|
4
|
+
import { unicornRules } from "./rules/unicornRules/unicornRules.js";
|
|
5
|
+
export const baseConfig = defineConfig({
|
|
6
|
+
categories: {
|
|
7
|
+
correctness: "error",
|
|
8
|
+
nursery: "off",
|
|
9
|
+
pedantic: "error",
|
|
10
|
+
perf: "error",
|
|
11
|
+
restriction: "error",
|
|
12
|
+
style: "error",
|
|
13
|
+
suspicious: "error",
|
|
14
|
+
},
|
|
15
|
+
plugins: ["eslint", "import", "oxc", "unicorn"],
|
|
16
|
+
rules: {
|
|
17
|
+
...eslintRules,
|
|
18
|
+
...typescriptRules,
|
|
19
|
+
...unicornRules,
|
|
20
|
+
"explicit-function-return-type": "off",
|
|
21
|
+
"explicit-module-boundary-types": "off",
|
|
22
|
+
"exports-last": "off",
|
|
23
|
+
"filename-case": "off",
|
|
24
|
+
"group-exports": "off",
|
|
25
|
+
"import/consistent-type-specifier-style": ["error", "prefer-top-level"],
|
|
26
|
+
"import/no-relative-parent-imports": "off",
|
|
27
|
+
"no-duplicate-imports": ["error", { allowSeparateTypeImports: true }],
|
|
28
|
+
"no-inline-comments": "off",
|
|
29
|
+
"no-named-export": "off",
|
|
30
|
+
"no-nested-ternary": "error",
|
|
31
|
+
"no-null": "off",
|
|
32
|
+
"no-rest-spread-properties": "off",
|
|
33
|
+
"no-ternary": "off",
|
|
34
|
+
"no-undefined": "off",
|
|
35
|
+
"no-unneeded-ternary": "error",
|
|
36
|
+
"no-warning-comments": "off",
|
|
37
|
+
"one-var": "off",
|
|
38
|
+
"oxc/no-async-await": "off",
|
|
39
|
+
"oxc/no-optional-chaining": "off",
|
|
40
|
+
"prefer-default-export": "off",
|
|
41
|
+
"sort-imports": "off",
|
|
42
|
+
},
|
|
43
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const eslintRules: Record<`eslint/${string}`, "off" | "warn" | "error" | ["error", "as-needed"] | ["error", 5] | ["warn", "all"] | ["error", 3] | ["warn", 3] | ["error", 10] | ["error", {
|
|
2
|
+
readonly max: 100;
|
|
3
|
+
}] | ["error", {
|
|
4
|
+
readonly IIFEs: true;
|
|
5
|
+
readonly max: 50;
|
|
6
|
+
readonly skipBlankLines: true;
|
|
7
|
+
readonly skipComments: true;
|
|
8
|
+
}] | ["warn", {
|
|
9
|
+
readonly boolean: true;
|
|
10
|
+
readonly number: true;
|
|
11
|
+
readonly string: true;
|
|
12
|
+
}] | ["error", {
|
|
13
|
+
readonly props: true;
|
|
14
|
+
}] | ["warn", "asc", {
|
|
15
|
+
readonly allowLineSeparatedGroups: true;
|
|
16
|
+
}]>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { withRulePrefix } from "../../../../utilities/withRulePrefix/withRulePrefix.js";
|
|
2
|
+
/* oxlint-disable no-magic-numbers */
|
|
3
|
+
export const eslintRules = withRulePrefix("eslint", {
|
|
4
|
+
"arrow-body-style": ["error", "as-needed"],
|
|
5
|
+
"complexity": ["error", 5],
|
|
6
|
+
"curly": ["warn", "all"],
|
|
7
|
+
"max-depth": ["error", 3],
|
|
8
|
+
"max-lines": ["error", { max: 100 }],
|
|
9
|
+
"max-lines-per-function": [
|
|
10
|
+
"error",
|
|
11
|
+
{
|
|
12
|
+
IIFEs: true,
|
|
13
|
+
max: 50,
|
|
14
|
+
skipBlankLines: true,
|
|
15
|
+
skipComments: true,
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
"max-nested-callbacks": ["error", 3],
|
|
19
|
+
"max-params": ["warn", 3],
|
|
20
|
+
"max-statements": ["error", 10],
|
|
21
|
+
"no-implicit-coercion": [
|
|
22
|
+
"warn",
|
|
23
|
+
{
|
|
24
|
+
boolean: true,
|
|
25
|
+
number: true,
|
|
26
|
+
string: true,
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
"no-magic-numbers": "warn",
|
|
30
|
+
"no-param-reassign": [
|
|
31
|
+
"error",
|
|
32
|
+
{
|
|
33
|
+
props: true,
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
"no-use-before-define": "error",
|
|
37
|
+
"prefer-named-capture-group": "warn",
|
|
38
|
+
"require-await": "off",
|
|
39
|
+
"sort-keys": ["warn", "asc", { allowLineSeparatedGroups: true }],
|
|
40
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const typescriptRules: Record<`typescript/${string}`, "off" | "error">;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const unicornRules: Record<`unicorn/${string}`, "off">;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export declare const reactConfig: {
|
|
2
|
+
extends: {
|
|
3
|
+
categories: {
|
|
4
|
+
correctness: "error";
|
|
5
|
+
nursery: "off";
|
|
6
|
+
pedantic: "error";
|
|
7
|
+
perf: "error";
|
|
8
|
+
restriction: "error";
|
|
9
|
+
style: "error";
|
|
10
|
+
suspicious: "error";
|
|
11
|
+
};
|
|
12
|
+
plugins: ("eslint" | "unicorn" | "oxc" | "import")[];
|
|
13
|
+
rules: {
|
|
14
|
+
"explicit-function-return-type": "off";
|
|
15
|
+
"explicit-module-boundary-types": "off";
|
|
16
|
+
"exports-last": "off";
|
|
17
|
+
"filename-case": "off";
|
|
18
|
+
"group-exports": "off";
|
|
19
|
+
"import/consistent-type-specifier-style": ["error", "prefer-top-level"];
|
|
20
|
+
"import/no-relative-parent-imports": "off";
|
|
21
|
+
"no-duplicate-imports": ["error", {
|
|
22
|
+
allowSeparateTypeImports: true;
|
|
23
|
+
}];
|
|
24
|
+
"no-inline-comments": "off";
|
|
25
|
+
"no-named-export": "off";
|
|
26
|
+
"no-nested-ternary": "error";
|
|
27
|
+
"no-null": "off";
|
|
28
|
+
"no-rest-spread-properties": "off";
|
|
29
|
+
"no-ternary": "off";
|
|
30
|
+
"no-undefined": "off";
|
|
31
|
+
"no-unneeded-ternary": "error";
|
|
32
|
+
"no-warning-comments": "off";
|
|
33
|
+
"one-var": "off";
|
|
34
|
+
"oxc/no-async-await": "off";
|
|
35
|
+
"oxc/no-optional-chaining": "off";
|
|
36
|
+
"prefer-default-export": "off";
|
|
37
|
+
"sort-imports": "off";
|
|
38
|
+
};
|
|
39
|
+
}[];
|
|
40
|
+
plugins: ("react" | "react-perf")[];
|
|
41
|
+
rules: {
|
|
42
|
+
"react-in-jsx-scope": "off";
|
|
43
|
+
"react/forbid-component-props": ["error", {
|
|
44
|
+
forbid: string[];
|
|
45
|
+
}];
|
|
46
|
+
"react/function-component-definition": ["error", {
|
|
47
|
+
namedComponents: "arrow-function";
|
|
48
|
+
}];
|
|
49
|
+
"react/jsx-filename-extension": ["error", {
|
|
50
|
+
extensions: string[];
|
|
51
|
+
}];
|
|
52
|
+
"react/jsx-max-depth": ["error", {
|
|
53
|
+
max: number;
|
|
54
|
+
}];
|
|
55
|
+
"react/jsx-no-literals": "off";
|
|
56
|
+
"react/jsx-props-no-spreading": "off";
|
|
57
|
+
};
|
|
58
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { defineConfig } from "oxlint";
|
|
2
|
+
import { baseConfig } from "../baseConfig/baseConfig.js";
|
|
3
|
+
export const reactConfig = defineConfig({
|
|
4
|
+
extends: [baseConfig],
|
|
5
|
+
plugins: ["react", "react-perf"],
|
|
6
|
+
rules: {
|
|
7
|
+
"react-in-jsx-scope": "off",
|
|
8
|
+
"react/forbid-component-props": ["error", { forbid: ["style"] }],
|
|
9
|
+
"react/function-component-definition": [
|
|
10
|
+
"error",
|
|
11
|
+
{
|
|
12
|
+
namedComponents: "arrow-function",
|
|
13
|
+
},
|
|
14
|
+
],
|
|
15
|
+
"react/jsx-filename-extension": [
|
|
16
|
+
"error",
|
|
17
|
+
{
|
|
18
|
+
extensions: ["tsx"],
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
"react/jsx-max-depth": ["error", { max: 5 }],
|
|
22
|
+
"react/jsx-no-literals": "off",
|
|
23
|
+
"react/jsx-props-no-spreading": "off",
|
|
24
|
+
},
|
|
25
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const withRulePrefix: <const Prefix extends string, Value>(prefix: Prefix, rules: Record<string, Value>) => Record<`${Prefix}/${string}`, Value>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,62 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ts-items/oxlint-config",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.0.1-alpha.1",
|
|
4
|
+
"description": "Strict shared oxlint configuration",
|
|
5
|
+
"homepage": "https://github.com/akky-xxxx/project-ts-items/tree/main/workspaces/packages/configurations/oxlint-config#readme",
|
|
6
|
+
"bugs": {
|
|
7
|
+
"url": "https://github.com/akky-xxxx/project-ts-items/issues"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/akky-xxxx/project-ts-items.git",
|
|
12
|
+
"directory": "workspaces/packages/configurations/oxlint-config"
|
|
13
|
+
},
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"type": "module",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/configurations/index.d.ts",
|
|
19
|
+
"default": "./dist/configurations/index.js"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"dist"
|
|
24
|
+
],
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "tsc -p tsconfig.build.json",
|
|
27
|
+
"check-code": "run-p lint test -c --aggregate-output",
|
|
28
|
+
"fix": "run-p fix:* -c --aggregate-output",
|
|
29
|
+
"fix:oxfmt": "oxfmt -c ./oxfmt.config.mts",
|
|
30
|
+
"fix:oxlint": "bun lint:oxlint --fix",
|
|
31
|
+
"fix:sort-package-json": "sort-package-json",
|
|
32
|
+
"lint": "run-p lint:* -c --aggregate-output",
|
|
33
|
+
"lint:cspell": "cspell lint \"**\" --no-progress",
|
|
34
|
+
"lint:knip": "knip -c knip.config.mts",
|
|
35
|
+
"lint:oxfmt": "bun fix:oxfmt --check",
|
|
36
|
+
"lint:oxlint": "oxlint -c ./oxlint.config.mts --deny-warnings --report-unused-disable-directives --format=stylish",
|
|
37
|
+
"lint:sort-package-json": "bun fix:sort-package-json --check",
|
|
38
|
+
"lint:type-check": "bun check",
|
|
39
|
+
"prepublishOnly": "bun run build",
|
|
40
|
+
"test": "bun run build && bun test"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@ts-items/configurations": "0.0.0",
|
|
44
|
+
"@ts-items/oxfmt-config": "0.0.1-alpha.1",
|
|
45
|
+
"@tsconfig/strictest": "2.0.8",
|
|
46
|
+
"@types/bun": "1.4.4",
|
|
47
|
+
"cspell": "10.4.0",
|
|
48
|
+
"knip": "6.43.0",
|
|
49
|
+
"npm-run-all2": "9.0.4",
|
|
50
|
+
"oxfmt": "0.75.0",
|
|
51
|
+
"oxlint": "1.90.0",
|
|
52
|
+
"oxlint-tsgolint": "7.0.2005",
|
|
53
|
+
"sort-package-json": "4.1.0",
|
|
54
|
+
"typescript": "6.0.3"
|
|
55
|
+
},
|
|
56
|
+
"peerDependencies": {
|
|
57
|
+
"oxlint": ">=1.89.0"
|
|
58
|
+
},
|
|
59
|
+
"publishConfig": {
|
|
60
|
+
"access": "public"
|
|
61
|
+
}
|
|
62
|
+
}
|