@switz/eslint-config 12.5.1 → 13.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.
@@ -0,0 +1,8 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "WebFetch(domain:oxc.rs)",
5
+ "WebSearch"
6
+ ]
7
+ }
8
+ }
package/.oxfmtrc.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "singleQuote": true,
3
+ "trailingComma": "es5",
4
+ "printWidth": 100,
5
+ "quoteProps": "consistent"
6
+ }
package/README.md CHANGED
@@ -46,6 +46,82 @@ export default [...main, ...react, ...tailwind];
46
46
 
47
47
  You should be able to combine configs just by spreading more into the array.
48
48
 
49
+ ## Oxlint + Oxfmt (Alternative)
50
+
51
+ This package also ships oxlint and oxfmt configs as a faster alternative to ESLint + Prettier.
52
+
53
+ ### Setup
54
+
55
+ Install oxlint and oxfmt, then reference the configs:
56
+
57
+ ```bash
58
+ pnpm install -D oxlint oxfmt
59
+ ```
60
+
61
+ Create an `oxlint.json` in your project root that extends the base config:
62
+
63
+ ```json
64
+ {
65
+ "$schema": "https://raw.githubusercontent.com/oxc-project/oxc/main/npm/oxlint/configuration_schema.json",
66
+ "extends": ["@switz/eslint-config/oxlint"]
67
+ }
68
+ ```
69
+
70
+ For React, add the react config:
71
+
72
+ ```json
73
+ {
74
+ "$schema": "https://raw.githubusercontent.com/oxc-project/oxc/main/npm/oxlint/configuration_schema.json",
75
+ "extends": [
76
+ "@switz/eslint-config/oxlint",
77
+ "@switz/eslint-config/oxlint/react"
78
+ ]
79
+ }
80
+ ```
81
+
82
+ For Tailwind, add the tailwind config:
83
+
84
+ ```json
85
+ {
86
+ "$schema": "https://raw.githubusercontent.com/oxc-project/oxc/main/npm/oxlint/configuration_schema.json",
87
+ "extends": [
88
+ "@switz/eslint-config/oxlint",
89
+ "@switz/eslint-config/oxlint/react",
90
+ "@switz/eslint-config/oxlint/tailwind"
91
+ ]
92
+ }
93
+ ```
94
+
95
+ Then run:
96
+
97
+ ```bash
98
+ oxlint -c oxlint.json
99
+ ```
100
+
101
+ **Formatting** — copy `.oxfmtrc.json` to your project root:
102
+
103
+ ```bash
104
+ cp node_modules/@switz/eslint-config/.oxfmtrc.json .oxfmtrc.json
105
+ oxfmt .
106
+ ```
107
+
108
+ Add scripts to your `package.json`:
109
+
110
+ ```json
111
+ {
112
+ "scripts": {
113
+ "lint:ox": "oxlint -c oxlint.json",
114
+ "fmt:ox": "oxfmt ."
115
+ }
116
+ }
117
+ ```
118
+
119
+ ### Gaps vs ESLint configs
120
+
121
+ - **React**: oxlint covers ~20 of 80+ `eslint-plugin-react` rules. Core rules like `jsx-key`, `no-direct-mutation-state`, hooks rules, and `jsx-no-duplicate-props` are covered. Rules like `no-unstable-nested-components`, `no-array-index-key`, `jsx-handler-names` are not.
122
+ - **MDX**: oxfmt formats `.mdx` files, but does not lint embedded code blocks like `eslint-plugin-mdx` does.
123
+ - **TypeScript type-aware rules**: oxlint's type-aware checking is in alpha (~73% coverage of `typescript-eslint` recommended rules).
124
+
49
125
  ## Reference
50
126
 
51
127
  https://eslint.org/docs/developer-guide/shareable-configs
package/oxlint.json ADDED
@@ -0,0 +1,85 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/oxc-project/oxc/main/npm/oxlint/configuration_schema.json",
3
+ "rules": {
4
+ "no-console": "warn",
5
+ "no-var": "error",
6
+ "no-unused-vars": [
7
+ "error",
8
+ {
9
+ "ignoreRestSiblings": true
10
+ }
11
+ ],
12
+ "prefer-arrow-callback": "error",
13
+ "no-template-curly-in-string": "error",
14
+ "prefer-const": [
15
+ "error",
16
+ {
17
+ "destructuring": "all"
18
+ }
19
+ ],
20
+ "no-undef": "error",
21
+ "no-redeclare": "error",
22
+ "no-debugger": "error",
23
+ "no-empty": "error",
24
+ "no-extra-boolean-cast": "error",
25
+ "no-irregular-whitespace": "error",
26
+ "no-loss-of-precision": "error",
27
+ "no-unsafe-finally": "error",
28
+ "no-unsafe-negation": "error",
29
+ "no-constant-condition": "error",
30
+ "no-dupe-args": "error",
31
+ "no-dupe-keys": "error",
32
+ "no-duplicate-case": "error",
33
+ "no-empty-character-class": "error",
34
+ "no-ex-assign": "error",
35
+ "no-func-assign": "error",
36
+ "no-inner-declarations": "error",
37
+ "no-invalid-regexp": "error",
38
+ "no-obj-calls": "error",
39
+ "no-prototype-builtins": "error",
40
+ "no-sparse-arrays": "error",
41
+ "no-unreachable": "error",
42
+ "use-isnan": "error",
43
+ "valid-typeof": "error",
44
+ "no-case-declarations": "error",
45
+ "no-empty-pattern": "error",
46
+ "no-fallthrough": "error",
47
+ "no-global-assign": "error",
48
+ "no-octal": "error",
49
+ "no-self-assign": "error",
50
+ "no-unused-labels": "error",
51
+ "no-useless-catch": "error",
52
+ "no-useless-escape": "error",
53
+ "no-with": "error",
54
+ "no-delete-var": "error",
55
+ "no-shadow-restricted-names": "error",
56
+ "require-yield": "error",
57
+ "typescript/no-unused-vars": [
58
+ "error",
59
+ {
60
+ "ignoreRestSiblings": true
61
+ }
62
+ ],
63
+ "typescript/no-explicit-any": "warn",
64
+ "typescript/no-non-null-assertion": "warn",
65
+ "typescript/ban-ts-comment": "warn",
66
+ "typescript/no-empty-interface": "error",
67
+ "typescript/no-extra-non-null-assertion": "error",
68
+ "typescript/no-misused-new": "error",
69
+ "typescript/no-namespace": "error",
70
+ "typescript/no-this-alias": "error",
71
+ "typescript/no-var-requires": "error",
72
+ "typescript/prefer-as-const": "error"
73
+ },
74
+ "overrides": [
75
+ {
76
+ "files": ["*.ts", "*.tsx", "*.mts", "*.cts"],
77
+ "rules": {
78
+ "no-undef": "off",
79
+ "no-unused-vars": "off",
80
+ "no-redeclare": "off"
81
+ }
82
+ }
83
+ ],
84
+ "ignorePatterns": ["node_modules", "dist", "build", ".next"]
85
+ }
@@ -0,0 +1,33 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/oxc-project/oxc/main/npm/oxlint/configuration_schema.json",
3
+ "plugins": ["react", "react-hooks"],
4
+ "rules": {
5
+ "react/jsx-key": "error",
6
+ "react/jsx-no-comment-textnodes": "error",
7
+ "react/jsx-no-duplicate-props": "error",
8
+ "react/jsx-no-target-blank": "error",
9
+ "react/jsx-no-undef": "error",
10
+ "react/jsx-no-useless-fragment": "warn",
11
+ "react/no-children-prop": "error",
12
+ "react/no-danger-with-children": "error",
13
+ "react/no-direct-mutation-state": "error",
14
+ "react/no-find-dom-node": "error",
15
+ "react/no-is-mounted": "error",
16
+ "react/no-render-return-value": "error",
17
+ "react/no-string-refs": "error",
18
+ "react/no-unescaped-entities": "error",
19
+ "react/no-unknown-property": "error",
20
+ "react/require-render-return": "error",
21
+ "react/void-dom-elements-no-children": "error",
22
+ "react/self-closing-comp": "warn",
23
+ "react/no-set-state": "off",
24
+ "react-hooks/rules-of-hooks": "error",
25
+ "react-hooks/exhaustive-deps": "warn",
26
+ "react/display-name": "off"
27
+ },
28
+ "settings": {
29
+ "react": {
30
+ "runtime": "automatic"
31
+ }
32
+ }
33
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/oxc-project/oxc/main/npm/oxlint/configuration_schema.json",
3
+ "plugins": ["better-tailwindcss"],
4
+ "rules": {
5
+ "better-tailwindcss/no-conflicting-classes": "error",
6
+ "better-tailwindcss/no-duplicate-classes": "error",
7
+ "better-tailwindcss/sort-classes": "warn",
8
+ "better-tailwindcss/no-unnecessary-whitespace": "warn",
9
+ "better-tailwindcss/enforce-consistent-line-wrapping": [
10
+ "warn",
11
+ {
12
+ "printWidth": 100
13
+ }
14
+ ]
15
+ },
16
+ "settings": {
17
+ "better-tailwindcss": {
18
+ "entryPoint": "src/styles/globals.css"
19
+ }
20
+ }
21
+ }
package/package.json CHANGED
@@ -1,9 +1,19 @@
1
1
  {
2
2
  "name": "@switz/eslint-config",
3
- "version": "12.5.1",
3
+ "version": "13.0.0",
4
4
  "description": "",
5
5
  "main": "eslint.config.mjs",
6
6
  "type": "module",
7
+ "exports": {
8
+ ".": "./eslint.config.mjs",
9
+ "./react": "./react.mjs",
10
+ "./tailwind": "./tailwind.mjs",
11
+ "./mdx": "./mdx.mjs",
12
+ "./oxlint": "./oxlint.json",
13
+ "./oxfmt": "./.oxfmtrc.json",
14
+ "./oxlint/tailwind": "./oxlint.tailwind.json",
15
+ "./oxlint/react": "./oxlint.react.json"
16
+ },
7
17
  "scripts": {
8
18
  "test": "echo \"Error: no test specified\" && exit 1",
9
19
  "eslint-check": "eslint-config-prettier eslint.config.mjs"
@@ -13,6 +23,10 @@
13
23
  "peerDependencies": {
14
24
  "eslint": ">= 9"
15
25
  },
26
+ "optionalPeerDependencies": {
27
+ "oxlint": ">= 0.16",
28
+ "oxfmt": ">= 0.1"
29
+ },
16
30
  "dependencies": {
17
31
  "@eslint/js": "^10.0.1",
18
32
  "@typescript-eslint/parser": "^8.56.0",
package/tailwind.mjs CHANGED
@@ -15,7 +15,7 @@ export default defineConfig([
15
15
  settings: {
16
16
  'better-tailwindcss': {
17
17
  // tailwindcss 4: the path to the entry file of the css based tailwind config (eg: `src/global.css`)
18
- entryPoint: 'src/styles/global.css',
18
+ entryPoint: 'src/styles/globals.css',
19
19
  },
20
20
  },
21
21
  },