@kasoa/oxlint-config 0.0.4 → 0.0.6

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 CHANGED
@@ -4,7 +4,7 @@ Kasoa's Oxlint config
4
4
 
5
5
  ## Installation
6
6
 
7
- Install Oxlint, typed linting support, and the config:
7
+ Install Oxlint, type-aware linting support, and the config:
8
8
 
9
9
  ```bash
10
10
  pnpm add -D @kasoa/oxlint-config oxlint oxlint-tsgolint
@@ -15,6 +15,7 @@ pnpm add -D @kasoa/oxlint-config oxlint oxlint-tsgolint
15
15
  ## Usage
16
16
 
17
17
  Import the desired config in your `oxlint.config.ts`. Extend it with project-specific overrides as needed.
18
+ The shared presets enable type-aware linting by default.
18
19
 
19
20
  ### React Projects
20
21
 
@@ -28,6 +29,8 @@ export { react as default } from "@kasoa/oxlint-config/react";
28
29
  export { node as default } from "@kasoa/oxlint-config/node";
29
30
  ```
30
31
 
32
+ This preset is intended for server-side runtimes such as Node.js, Bun, and Workers-style server code.
33
+
31
34
  ### Base Config
32
35
 
33
36
  ```ts
@@ -58,7 +61,7 @@ Type-aware linting is expected by default:
58
61
  ```json
59
62
  {
60
63
  "scripts": {
61
- "lint": "oxlint --type-aware --fix .",
64
+ "lint": "oxlint --fix .",
62
65
  "format": "oxfmt ."
63
66
  }
64
67
  }
@@ -66,9 +69,9 @@ Type-aware linting is expected by default:
66
69
 
67
70
  ## Configurations
68
71
 
69
- - **`base`**: Core rules for TypeScript-first code quality.
70
- - **`node`**: Extends `base` with Node.js, import cycle, and test rules.
71
- - **`react`**: Extends `base` with React, JSX a11y, import cycle, and test rules.
72
+ - **`base`**: Core rules for TypeScript-first code quality, promise usage, import graph safety, and Vitest.
73
+ - **`node`**: Extends `base` with server-runtime `node` plugin rules without assuming Node globals by default.
74
+ - **`react`**: Extends `base` with React, React performance, and JSX a11y rules.
72
75
 
73
76
  ## Author
74
77
 
@@ -1,43 +1,3 @@
1
- export declare const base: {
2
- plugins: ("import" | "oxc" | "typescript" | "unicorn")[];
3
- rules: {
4
- "default-case-last": "error";
5
- eqeqeq: "error";
6
- "grouped-accessor-pairs": string[];
7
- "max-params": "warn";
8
- "no-alert": "error";
9
- "no-console": (string | {
10
- allow: string[];
11
- })[];
12
- "no-constructor-return": "error";
13
- "no-else-return": (string | {
14
- allowElseIf: boolean;
15
- })[];
16
- "no-param-reassign": (string | {
17
- props: boolean;
18
- })[];
19
- "no-unneeded-ternary": "error";
20
- "no-useless-return": "error";
21
- "prefer-template": "error";
22
- "typescript/ban-ts-comment": (string | {
23
- minimumDescriptionLength: number;
24
- })[];
25
- "typescript/consistent-type-imports": "error";
26
- "typescript/no-explicit-any": "warn";
27
- "typescript/no-floating-promises": "error";
28
- "typescript/no-misused-promises": "error";
29
- "typescript/no-unsafe-assignment": "warn";
30
- "typescript/no-unsafe-call": "warn";
31
- "typescript/no-unsafe-member-access": "warn";
32
- "typescript/no-unsafe-return": "warn";
33
- "typescript/no-require-imports": "off";
34
- "typescript/require-array-sort-compare": "error";
35
- "typescript/switch-exhaustiveness-check": "error";
36
- "typescript/await-thenable": "error";
37
- "getter-return": "error";
38
- "no-undef": "error";
39
- "no-unreachable": "error";
40
- "typescript/prefer-optional-chain": "warn";
41
- };
42
- };
1
+ import type { OxlintConfig } from "oxlint";
2
+ export declare const base: OxlintConfig;
43
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/base/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmCf,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/base/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAG3C,eAAO,MAAM,IAAI,EAAE,YAwHjB,CAAC"}
@@ -1,35 +1,119 @@
1
1
  import { defineConfig } from "oxlint";
2
2
  export const base = defineConfig({
3
- plugins: ["typescript", "unicorn", "oxc", "import"],
3
+ plugins: ["typescript", "unicorn", "oxc", "import", "promise", "vitest"],
4
+ options: {
5
+ typeAware: true,
6
+ },
7
+ categories: {
8
+ correctness: "error",
9
+ suspicious: "error",
10
+ pedantic: "error",
11
+ perf: "error",
12
+ style: "error",
13
+ },
4
14
  rules: {
15
+ "func-style": "off",
16
+ "id-length": "off",
17
+ "capitalized-comments": "off",
18
+ "init-declarations": "off",
19
+ "no-magic-numbers": "off",
20
+ "no-ternary": "off",
21
+ "sort-imports": "off",
22
+ "sort-keys": "off",
23
+ "vars-on-top": "off",
24
+ complexity: ["error", { max: 10 }],
5
25
  "default-case-last": "error",
6
26
  eqeqeq: "error",
27
+ "getter-return": "error",
7
28
  "grouped-accessor-pairs": ["error", "getBeforeSet"],
8
- "max-params": "warn",
9
- "no-alert": "error",
10
- "no-console": ["warn", { allow: ["info", "warn", "error"] }],
11
- "no-constructor-return": "error",
12
- "no-else-return": ["error", { allowElseIf: false }],
13
- "no-param-reassign": ["error", { props: false }],
29
+ "max-classes-per-file": ["error", { max: 1 }],
30
+ "max-depth": ["error", { max: 3 }],
31
+ "max-lines-per-function": ["error", { max: 50, skipBlankLines: true, skipComments: true }],
32
+ "max-nested-callbacks": ["error", { max: 3 }],
33
+ "max-params": ["error", { max: 3 }],
34
+ "max-statements": ["error", { max: 10 }],
35
+ "no-console": ["error", { allow: ["info", "warn", "error"] }],
36
+ "no-duplicate-imports": ["error", { allowSeparateTypeImports: true }],
37
+ "no-param-reassign": ["error", { props: true }],
38
+ "no-undef": "error",
14
39
  "no-unneeded-ternary": "error",
40
+ "no-unreachable": "error",
15
41
  "no-useless-return": "error",
16
42
  "prefer-template": "error",
43
+ "import/exports-last": "off",
44
+ "import/group-exports": "off",
45
+ "import/no-named-export": "off",
46
+ "import/no-namespace": "off",
47
+ "import/no-nodejs-modules": "off",
48
+ "import/prefer-default-export": "off",
49
+ "typescript/consistent-type-definitions": "off",
50
+ "import/no-cycle": "error",
17
51
  "typescript/ban-ts-comment": ["error", { minimumDescriptionLength: 10 }],
18
- "typescript/consistent-type-imports": "error",
19
- "typescript/no-explicit-any": "warn",
52
+ "typescript/consistent-return": "error",
53
+ "typescript/consistent-type-exports": "error",
54
+ "typescript/consistent-type-imports": [
55
+ "error",
56
+ { prefer: "type-imports", fixStyle: "separate-type-imports" },
57
+ ],
58
+ "typescript/dot-notation": "error",
59
+ "typescript/no-confusing-void-expression": "error",
60
+ "typescript/no-explicit-any": "error",
20
61
  "typescript/no-floating-promises": "error",
21
62
  "typescript/no-misused-promises": "error",
22
- "typescript/no-unsafe-assignment": "warn",
23
- "typescript/no-unsafe-call": "warn",
24
- "typescript/no-unsafe-member-access": "warn",
25
- "typescript/no-unsafe-return": "warn",
26
- "typescript/no-require-imports": "off",
63
+ "typescript/no-misused-spread": "error",
64
+ "typescript/no-require-imports": "error",
65
+ "typescript/no-unnecessary-condition": "error",
66
+ "typescript/no-unnecessary-qualifier": "error",
67
+ "typescript/no-unnecessary-type-arguments": "error",
68
+ "typescript/no-unnecessary-type-assertion": "error",
69
+ "typescript/no-unnecessary-type-parameters": "error",
70
+ "typescript/no-unsafe-argument": "error",
71
+ "typescript/no-unsafe-assignment": "error",
72
+ "typescript/no-unsafe-call": "error",
73
+ "typescript/no-unsafe-member-access": "error",
74
+ "typescript/no-unsafe-return": "error",
75
+ "typescript/no-useless-default-assignment": "error",
76
+ "typescript/non-nullable-type-assertion-style": "error",
77
+ "typescript/only-throw-error": "error",
78
+ "typescript/prefer-find": "error",
79
+ "typescript/prefer-nullish-coalescing": "error",
80
+ "typescript/prefer-optional-chain": "error",
81
+ "typescript/prefer-readonly": "error",
82
+ "typescript/prefer-readonly-parameter-types": "error",
83
+ "typescript/prefer-regexp-exec": "error",
84
+ "typescript/promise-function-async": "error",
27
85
  "typescript/require-array-sort-compare": "error",
86
+ "typescript/restrict-plus-operands": "error",
87
+ "typescript/restrict-template-expressions": "error",
88
+ "typescript/return-await": "error",
89
+ "typescript/strict-boolean-expressions": "error",
90
+ "typescript/strict-void-return": "error",
28
91
  "typescript/switch-exhaustiveness-check": "error",
29
- "typescript/await-thenable": "error",
30
- "getter-return": "error",
31
- "no-undef": "error",
32
- "no-unreachable": "error",
33
- "typescript/prefer-optional-chain": "warn",
92
+ "typescript/unbound-method": "error",
93
+ "typescript/use-unknown-in-catch-callback-variable": "error",
94
+ "unicorn/no-null": "off",
95
+ "unicorn/filename-case": ["error", { case: "kebabCase" }],
34
96
  },
97
+ overrides: [
98
+ {
99
+ files: ["**/*.{cjs,cts}"],
100
+ env: {
101
+ node: true,
102
+ },
103
+ rules: {
104
+ "typescript/no-require-imports": "off",
105
+ },
106
+ },
107
+ {
108
+ files: ["**/tests/**", "**/__tests__/**", "**/*.{test,spec}.{js,jsx,ts,tsx,mjs,cjs,mts,cts}"],
109
+ env: {
110
+ vitest: true,
111
+ },
112
+ rules: {
113
+ "max-lines-per-function": ["error", { max: 75, skipBlankLines: true, skipComments: true }],
114
+ "vitest/no-importing-vitest-globals": "off",
115
+ "vitest/max-nested-describe": ["error", { max: 3 }],
116
+ },
117
+ },
118
+ ],
35
119
  });
@@ -1,60 +1,3 @@
1
- export declare const node: {
2
- plugins: ("import" | "node" | "oxc" | "typescript" | "unicorn" | "vitest")[];
3
- env: {
4
- node: true;
5
- vitest: true;
6
- };
7
- rules: {
8
- "default-case-last": "error";
9
- eqeqeq: "error";
10
- "grouped-accessor-pairs": string[];
11
- "max-params": "warn";
12
- "no-alert": "error";
13
- "no-console": (string | {
14
- allow: string[];
15
- })[];
16
- "no-constructor-return": "error";
17
- "no-else-return": (string | {
18
- allowElseIf: boolean;
19
- })[];
20
- "no-param-reassign": (string | {
21
- props: boolean;
22
- })[];
23
- "no-unneeded-ternary": "error";
24
- "no-useless-return": "error";
25
- "prefer-template": "error";
26
- "typescript/ban-ts-comment": (string | {
27
- minimumDescriptionLength: number;
28
- })[];
29
- "typescript/consistent-type-imports": "error";
30
- "typescript/no-explicit-any": "warn";
31
- "typescript/no-floating-promises": "error";
32
- "typescript/no-misused-promises": "error";
33
- "typescript/no-unsafe-assignment": "warn";
34
- "typescript/no-unsafe-call": "warn";
35
- "typescript/no-unsafe-member-access": "warn";
36
- "typescript/no-unsafe-return": "warn";
37
- "typescript/no-require-imports": "off";
38
- "typescript/require-array-sort-compare": "error";
39
- "typescript/switch-exhaustiveness-check": "error";
40
- "typescript/await-thenable": "error";
41
- "getter-return": "error";
42
- "no-undef": "error";
43
- "no-unreachable": "error";
44
- "typescript/prefer-optional-chain": "warn";
45
- "import/no-cycle": "error";
46
- "node/no-exports-assign": "error";
47
- "vitest/no-focused-tests": "error";
48
- "vitest/no-disabled-tests": "error";
49
- "vitest/no-standalone-expect": "error";
50
- };
51
- overrides: {
52
- files: string[];
53
- rules: {
54
- "vitest/max-nested-describe": (string | {
55
- max: number;
56
- })[];
57
- };
58
- }[];
59
- };
1
+ import type { OxlintConfig } from "oxlint";
2
+ export declare const node: OxlintConfig;
60
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/node/index.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuBf,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/node/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAI3C,eAAO,MAAM,IAAI,EAAE,YAOjB,CAAC"}
@@ -2,25 +2,9 @@ import { defineConfig } from "oxlint";
2
2
  import { base } from "../base/index.js";
3
3
  export const node = defineConfig({
4
4
  ...base,
5
- plugins: [...base.plugins, "node", "vitest"],
6
- env: {
7
- node: true,
8
- vitest: true,
9
- },
5
+ plugins: [...(base.plugins ?? []), "node"],
10
6
  rules: {
11
7
  ...base.rules,
12
- "import/no-cycle": "error",
13
8
  "node/no-exports-assign": "error",
14
- "vitest/no-focused-tests": "error",
15
- "vitest/no-disabled-tests": "error",
16
- "vitest/no-standalone-expect": "error",
17
9
  },
18
- overrides: [
19
- {
20
- files: ["**/tests/**", "**/*.test.{ts,tsx}", "**/*.spec.{ts,tsx}"],
21
- rules: {
22
- "vitest/max-nested-describe": ["warn", { max: 3 }],
23
- },
24
- },
25
- ],
26
10
  });
@@ -1,62 +1,3 @@
1
- export declare const react: {
2
- plugins: ("import" | "jsx-a11y" | "oxc" | "react" | "typescript" | "unicorn" | "vitest")[];
3
- env: {
4
- vitest: true;
5
- };
6
- rules: {
7
- "default-case-last": "error";
8
- eqeqeq: "error";
9
- "grouped-accessor-pairs": string[];
10
- "max-params": "warn";
11
- "no-alert": "error";
12
- "no-console": (string | {
13
- allow: string[];
14
- })[];
15
- "no-constructor-return": "error";
16
- "no-else-return": (string | {
17
- allowElseIf: boolean;
18
- })[];
19
- "no-param-reassign": (string | {
20
- props: boolean;
21
- })[];
22
- "no-unneeded-ternary": "error";
23
- "no-useless-return": "error";
24
- "prefer-template": "error";
25
- "typescript/ban-ts-comment": (string | {
26
- minimumDescriptionLength: number;
27
- })[];
28
- "typescript/consistent-type-imports": "error";
29
- "typescript/no-explicit-any": "warn";
30
- "typescript/no-floating-promises": "error";
31
- "typescript/no-misused-promises": "error";
32
- "typescript/no-unsafe-assignment": "warn";
33
- "typescript/no-unsafe-call": "warn";
34
- "typescript/no-unsafe-member-access": "warn";
35
- "typescript/no-unsafe-return": "warn";
36
- "typescript/no-require-imports": "off";
37
- "typescript/require-array-sort-compare": "error";
38
- "typescript/switch-exhaustiveness-check": "error";
39
- "typescript/await-thenable": "error";
40
- "getter-return": "error";
41
- "no-undef": "error";
42
- "no-unreachable": "error";
43
- "typescript/prefer-optional-chain": "warn";
44
- "import/no-cycle": "error";
45
- "react/jsx-key": "error";
46
- "react/no-direct-mutation-state": "error";
47
- "react/no-unknown-property": "error";
48
- "jsx-a11y/alt-text": "error";
49
- "vitest/no-focused-tests": "error";
50
- "vitest/no-disabled-tests": "error";
51
- "vitest/no-standalone-expect": "error";
52
- };
53
- overrides: {
54
- files: string[];
55
- rules: {
56
- "vitest/max-nested-describe": (string | {
57
- max: number;
58
- })[];
59
- };
60
- }[];
61
- };
1
+ import type { OxlintConfig } from "oxlint";
2
+ export declare const react: OxlintConfig;
62
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/react/index.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyBhB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/react/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAI3C,eAAO,MAAM,KAAK,EAAE,YA6BlB,CAAC"}
@@ -2,27 +2,29 @@ import { defineConfig } from "oxlint";
2
2
  import { base } from "../base/index.js";
3
3
  export const react = defineConfig({
4
4
  ...base,
5
- plugins: [...base.plugins, "react", "jsx-a11y", "vitest"],
6
- env: {
7
- vitest: true,
8
- },
5
+ plugins: [...(base.plugins ?? []), "react", "react-perf", "jsx-a11y"],
9
6
  rules: {
10
7
  ...base.rules,
11
- "import/no-cycle": "error",
8
+ "jsx-a11y/alt-text": "error",
9
+ "react/jsx-props-no-spreading": "off",
10
+ "react/exhaustive-deps": "error",
12
11
  "react/jsx-key": "error",
12
+ "react/jsx-max-depth": ["error", { max: 4 }],
13
+ "react/jsx-no-constructed-context-values": "error",
14
+ "react/jsx-no-duplicate-props": "error",
15
+ "react/jsx-no-undef": "error",
16
+ "react/no-array-index-key": "error",
17
+ "react/no-children-prop": "error",
18
+ "react/no-danger-with-children": "error",
13
19
  "react/no-direct-mutation-state": "error",
20
+ "react/no-find-dom-node": "error",
21
+ "react/no-string-refs": "error",
22
+ "react/no-unsafe": "error",
14
23
  "react/no-unknown-property": "error",
15
- "jsx-a11y/alt-text": "error",
16
- "vitest/no-focused-tests": "error",
17
- "vitest/no-disabled-tests": "error",
18
- "vitest/no-standalone-expect": "error",
24
+ "react/void-dom-elements-no-children": "error",
25
+ "react-perf/jsx-no-jsx-as-prop": "error",
26
+ "react-perf/jsx-no-new-array-as-prop": "error",
27
+ "react-perf/jsx-no-new-function-as-prop": "error",
28
+ "react-perf/jsx-no-new-object-as-prop": "error",
19
29
  },
20
- overrides: [
21
- {
22
- files: ["**/tests/**", "**/*.test.{ts,tsx}", "**/*.spec.{ts,tsx}"],
23
- rules: {
24
- "vitest/max-nested-describe": ["warn", { max: 3 }],
25
- },
26
- },
27
- ],
28
30
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kasoa/oxlint-config",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "description": "Kasoa's Oxlint configurations",
5
5
  "keywords": [
6
6
  "kasoa",
@@ -37,13 +37,13 @@
37
37
  "devDependencies": {
38
38
  "@types/node": "^25.3.0",
39
39
  "@typescript/native-preview": "^7.0.0-dev.20260224.1",
40
- "oxfmt": "^0.35.0",
41
- "oxlint": "^1.50.0",
42
- "oxlint-tsgolint": "^0.14.2"
40
+ "oxfmt": "^0.36.0",
41
+ "oxlint": "^1.51.0",
42
+ "oxlint-tsgolint": "^0.16.0"
43
43
  },
44
44
  "peerDependencies": {
45
- "oxlint": ">=1.46.0 <2",
46
- "oxlint-tsgolint": ">=0.12.0 <1"
45
+ "oxlint": ">=1.51.0 <2",
46
+ "oxlint-tsgolint": ">=0.16.0 <1"
47
47
  },
48
48
  "engines": {
49
49
  "node": ">=24"
@@ -51,7 +51,7 @@
51
51
  "scripts": {
52
52
  "dev": "tsgo --watch",
53
53
  "build": "tsgo",
54
- "lint": "oxlint --type-aware --fix .",
54
+ "lint": "oxlint --fix .",
55
55
  "format": "oxfmt .",
56
56
  "typecheck": "tsgo --noEmit",
57
57
  "test": "echo 'No tests'"