@nelsonlaidev/oxlint-config 0.3.2 → 1.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 CHANGED
@@ -1,5 +1,9 @@
1
1
  # @nelsonlaidev/oxlint-config
2
2
 
3
+ [![Version](https://img.shields.io/npm/v/@nelsonlaidev/oxlint-config?style=flat&colorA=333333&colorB=000000)](https://npmx.dev/package/@nelsonlaidev/oxlint-config)
4
+ [![Downloads](https://img.shields.io/npm/dt/@nelsonlaidev/oxlint-config.svg?style=flat&colorA=333333&colorB=000000)](https://npmx.dev/package/@nelsonlaidev/oxlint-config)
5
+ [![License](https://img.shields.io/npm/l/@nelsonlaidev/oxlint-config?style=flat&colorA=333333&colorB=000000)](https://github.com/nelsonlaidev/config/blob/main/LICENSE)
6
+
3
7
  Personal Oxlint configurations for Nelson Lai projects.
4
8
 
5
9
  This package is synced from `eslint-config` and aims to enable every supported Oxlint rule that is also enabled in `eslint-config`.
@@ -23,13 +27,53 @@ Create an `oxlint.config.ts` file with the following content:
23
27
  ```ts
24
28
  import { defineConfig } from '@nelsonlaidev/oxlint-config'
25
29
 
30
+ export default defineConfig()
31
+ ```
32
+
33
+ Optional presets are explicit Oxlint overrides. Add only the presets your project uses:
34
+
35
+ ```ts
36
+ import { defineConfig, nextjs, playwright, react, tailwindcss, vitest } from '@nelsonlaidev/oxlint-config'
37
+
26
38
  export default defineConfig({
27
- config: {
28
- // Custom OxLint configuration options
29
- },
30
- custom: {
31
- react: true,
39
+ settings: {
40
+ 'better-tailwindcss': {
41
+ entryPoint: './src/globals.css',
42
+ },
32
43
  },
44
+ overrides: [
45
+ react(),
46
+ nextjs(),
47
+ tailwindcss(),
48
+ vitest({
49
+ files: ['**/*.test.ts'],
50
+ }),
51
+ playwright({
52
+ files: ['e2e/**/*.spec.ts'],
53
+ }),
54
+ ],
55
+ })
56
+ ```
57
+
58
+ Each preset accepts a native Oxlint override object. Use it to replace `files`, add plugins, or override rules:
59
+
60
+ ```ts
61
+ export default defineConfig({
62
+ ignorePatterns: ['generated/**'],
63
+ overrides: [
64
+ react({
65
+ files: ['src/**/*.{js,jsx,ts,tsx}'],
66
+ rules: {
67
+ '@eslint-react/no-array-index-key': 'off',
68
+ },
69
+ }),
70
+ {
71
+ files: ['scripts/**/*.ts'],
72
+ rules: {
73
+ 'eslint/no-console': 'off',
74
+ },
75
+ },
76
+ ],
33
77
  })
34
78
  ```
35
79
 
@@ -37,8 +81,6 @@ export default defineConfig({
37
81
 
38
82
  This package follows `eslint-config` as the source of truth. When a rule is enabled there, we enable the corresponding Oxlint rule here when Oxlint supports it.
39
83
 
40
- `unused-imports` is intentionally not included. Oxlint's built-in `no-unused-vars` rule with `fix.imports: "safe-fix"` accomplishes the same goal natively.
41
-
42
84
  ### What's Included
43
85
 
44
86
  This config includes opinionated rules from the following plugins:
@@ -47,71 +89,73 @@ This config includes opinionated rules from the following plugins:
47
89
 
48
90
  - `oxc`
49
91
  - `eslint`
92
+ - `command`
50
93
  - `typescript`
51
94
  - `unicorn`
52
95
  - `promise`
53
96
  - `node`
54
97
  - `jsx-a11y`
55
- - `import` / `import-sort`
98
+ - `import`
56
99
  - `jsdoc`
100
+ - `nelsonlaidev`
57
101
  - `stylistic`
58
102
  - `de-morgan`
59
103
  - `zod`
60
104
  - `regexp`
61
105
  - `sonarjs`
106
+ - `import-sort`
62
107
 
63
- #### Conditionally enabled
108
+ #### Optional presets
64
109
 
65
- - `react` — auto-detected or via `react` option
66
- - `nextjs` — auto-detected or via `nextjs` option
67
- - `vitest` — via `vitest` option
68
- - `playwright` — via `playwright` option
69
- - `tailwindcss` — via `tailwindcss` option
110
+ - `react`
111
+ - `nextjs`
112
+ - `vitest`
113
+ - `playwright`
114
+ - `tailwindcss`
70
115
 
71
116
  ## Migration Status
72
117
 
73
118
  <!-- sync:report-start -->
74
119
 
75
- ### Synced (auto-generated)
76
-
77
- | Preset | Synced | Total | Coverage |
78
- | ------------------------------------ | ------ | ----- | -------- |
79
- | `eslint/javascript/rules` | 93 | 95 | 97.9% |
80
- | `unicorn/unicorn/rules` | 125 | 133 | 94.0% |
81
- | `typescript/typescript/rules` | 94 | 108 | 87.0% |
82
- | `typescript/typescript/declarations` | 2 | 2 | 100.0% |
83
- | `import/import-x/rules` | 17 | 23 | 73.9% |
84
- | `jsdoc/jsdoc/rules` | 2 | 2 | 100.0% |
85
- | `vitest/vitest/rules` | 20 | 20 | 100.0% |
86
- | `jsx-a11y/jsx-a11y/rules` | 33 | 33 | 100.0% |
87
- | `nextjs/nextjs/rules` | 21 | 21 | 100.0% |
88
- | `promise/promise/rules` | 15 | 15 | 100.0% |
89
- | `node/node/rules` | 2 | 6 | 33.3% |
90
-
91
- ### Manually maintained (diff-only)
120
+ ### Sync Summary
121
+
122
+ | Preset | Synced | Dropped | Classified | Unclassified | Coverage |
123
+ | ------------------------------------------------- | -----: | ------: | ---------: | -----------: | -------: |
124
+ | `command/nelsonlaidev/command/rules` | 1 | 0 | 0 | 0 | 100.0% |
125
+ | `de-morgan/nelsonlaidev/de-morgan/rules` | 2 | 0 | 0 | 0 | 100.0% |
126
+ | `eslint/nelsonlaidev/javascript/rules` | 93 | 2 | 2 | 0 | 100.0% |
127
+ | `import-sort/nelsonlaidev/import-sort/rules` | 2 | 0 | 0 | 0 | 100.0% |
128
+ | `imports/nelsonlaidev/import-x/rules` | 20 | 6 | 6 | 0 | 84.6% |
129
+ | `jsdoc/nelsonlaidev/jsdoc/rules` | 2 | 0 | 0 | 0 | 100.0% |
130
+ | `jsx-a11y/nelsonlaidev/jsx-a11y/rules` | 35 | 1 | 1 | 0 | 100.0% |
131
+ | `nelsonlaidev/nelsonlaidev/nelsonlaidev/rules` | 5 | 0 | 0 | 0 | 100.0% |
132
+ | `nextjs/nelsonlaidev/nextjs/rules` | 21 | 0 | 0 | 0 | 100.0% |
133
+ | `node/nelsonlaidev/node/rules` | 2 | 4 | 4 | 0 | 50.0% |
134
+ | `playwright/nelsonlaidev/playwright/rules` | 36 | 0 | 0 | 0 | 100.0% |
135
+ | `promise/nelsonlaidev/promise/rules` | 16 | 1 | 1 | 0 | 100.0% |
136
+ | `react/nelsonlaidev/react/rules` | 99 | 2 | 2 | 0 | 100.0% |
137
+ | `regexp/nelsonlaidev/regexp/rules` | 67 | 0 | 0 | 0 | 100.0% |
138
+ | `sonarjs/nelsonlaidev/sonarjs/rules` | 268 | 0 | 0 | 0 | 100.0% |
139
+ | `stylistic/nelsonlaidev/stylistic/rules` | 1 | 0 | 0 | 0 | 100.0% |
140
+ | `tailwindcss/nelsonlaidev/tailwindcss/rules` | 9 | 0 | 0 | 0 | 100.0% |
141
+ | `typescript/nelsonlaidev/typescript/rules` | 117 | 21 | 21 | 0 | 100.0% |
142
+ | `typescript/nelsonlaidev/typescript/declarations` | 2 | 0 | 0 | 0 | 100.0% |
143
+ | `unicorn/nelsonlaidev/unicorn/rules` | 134 | 195 | 195 | 0 | 41.0% |
144
+ | `vitest/nelsonlaidev/vitest/rules` | 20 | 0 | 0 | 0 | 100.0% |
145
+ | `zod/nelsonlaidev/zod/rules` | 1 | 0 | 0 | 0 | 100.0% |
146
+
147
+ ### Unclassified Dropped Rules
148
+
149
+ No unclassified dropped rules.
92
150
 
93
- These use `jsPlugins` and are checked for consistency via `sync:check`.
94
-
95
- - `regexp`
96
- - `playwright`
97
- - `sonarjs`
98
- - `zod`
99
- - `command`
100
- - `stylistic`
101
- - `de-morgan`
102
- - `tailwindcss`
103
- - `react`
104
- - `nelsonlaidev`
151
+ <!-- sync:report-end -->
105
152
 
106
- ### Unscanned ESLint plugins
153
+ ### Configs Not Migrated
107
154
 
108
155
  | Config | Reason |
109
156
  | ------------------- | --------------------------------------------------------------- |
110
157
  | `comments.ts` | Plugin that comments out eslint-disable directives |
111
158
  | `gitignore.ts` | File-based ignores, handled by Oxlint config |
112
159
  | `ignores.ts` | File ignore patterns |
113
- | `import-sort.ts` | Replaced by Oxlint built-in `import/sort` |
114
160
  | `prettier.ts` | Formatting concern, handled by oxfmt |
115
161
  | `unused-imports.ts` | Replaced by Oxlint built-in `no-unused-vars` with `fix.imports` |
116
-
117
- <!-- sync:report-end -->
package/dist/index.d.mts CHANGED
@@ -1,144 +1,22 @@
1
- import { OxlintConfig, OxlintConfig as OxlintConfig$1, OxlintOverride } from "oxlint";
2
- import { Selectors } from "eslint-plugin-better-tailwindcss/types";
1
+ import { OxlintConfig, OxlintConfig as OxlintConfig$1, OxlintOverride, OxlintOverride as OxlintOverride$1 } from "oxlint";
3
2
 
4
- //#region src/types/playwright.d.ts
5
- type PlaywrightConfig = {
6
- /**
7
- * A list of glob patterns for your Playwright test files.
8
- */
9
- files: OxlintOverride['files'];
10
- /**
11
- * See [official docs](https://github.com/mskelton/eslint-plugin-playwright/blob/main/docs/rules/expect-expect.md#assertfunctionnames) for more details.
12
- * @default []
13
- */
14
- assertFunctionNames?: string[];
15
- /**
16
- * See [official docs](https://github.com/mskelton/eslint-plugin-playwright/blob/main/docs/rules/expect-expect.md#assertfunctionpatterns) for more details.
17
- * @default []
18
- */
19
- assertFunctionPatterns?: string[];
20
- };
3
+ //#region src/base.d.ts
4
+ declare const defineConfig: (config?: OxlintConfig$1) => OxlintConfig$1;
21
5
  //#endregion
22
- //#region src/types/tailwindcss.d.ts
23
- type TailwindCSSConfig = {
24
- /**
25
- * See [official docs](https://github.com/schoero/eslint-plugin-better-tailwindcss/blob/main/docs/settings/settings.md#entrypoint) for more details.
26
- */
27
- entryPoint?: string;
28
- /**
29
- * See [official docs](https://github.com/schoero/eslint-plugin-better-tailwindcss/blob/main/docs/settings/settings.md#tailwindconfig) for more details.
30
- */
31
- tailwindConfig?: string;
32
- /**
33
- * See [official docs](https://github.com/schoero/eslint-plugin-better-tailwindcss/blob/main/docs/settings/settings.md#tsconfig) for more details.
34
- */
35
- tsconfig?: string;
36
- /**
37
- * See [official docs](https://github.com/schoero/eslint-plugin-better-tailwindcss/blob/main/docs/settings/settings.md#detectcomponentclasses) for more details.
38
- * @default false
39
- */
40
- detectComponentClasses?: boolean;
41
- /**
42
- * See [official docs](https://github.com/schoero/eslint-plugin-better-tailwindcss/blob/main/docs/settings/settings.md#rootfontsize) for more details.
43
- * @default 16
44
- */
45
- rootFontSize?: number;
46
- /**
47
- * See [official docs](https://github.com/schoero/eslint-plugin-better-tailwindcss/blob/main/docs/settings/settings.md#messagestyle) for more details.
48
- */
49
- messageStyle?: 'visual' | 'compact' | 'raw';
50
- /**
51
- * See [official docs](https://github.com/schoero/eslint-plugin-better-tailwindcss/blob/main/docs/settings/settings.md#selectors) for more details.
52
- */
53
- selectors?: Selectors;
54
- canonical?: {
55
- /**
56
- * See [official docs](https://github.com/schoero/eslint-plugin-better-tailwindcss/blob/main/docs/rules/enforce-canonical-classes.md#collapse) for more details.
57
- * @default true
58
- */
59
- collapse?: boolean;
60
- /**
61
- * See [official docs](https://github.com/schoero/eslint-plugin-better-tailwindcss/blob/main/docs/rules/enforce-canonical-classes.md#logical) for more details.
62
- * @default true
63
- */
64
- logical?: boolean;
65
- };
66
- classOrder?: {
67
- /**
68
- * See [official docs](https://github.com/schoero/eslint-plugin-better-tailwindcss/blob/main/docs/rules/enforce-consistent-class-order.md#order) for more details.
69
- * @default 'official'
70
- */
71
- order?: 'asc' | 'desc' | 'official' | 'strict';
72
- /**
73
- * See [official docs](https://github.com/schoero/eslint-plugin-better-tailwindcss/blob/main/docs/rules/enforce-consistent-class-order.md#componentClassOrder) for more details.
74
- * @default 'preserve'
75
- */
76
- componentOrder?: 'asc' | 'desc' | 'preserve';
77
- /**
78
- * See [official docs](https://github.com/schoero/eslint-plugin-better-tailwindcss/blob/main/docs/rules/enforce-consistent-class-order.md#componentClassPosition) for more details.
79
- * @default 'start'
80
- */
81
- componentPosition?: 'start' | 'end';
82
- /**
83
- * See [official docs](https://github.com/schoero/eslint-plugin-better-tailwindcss/blob/main/docs/rules/enforce-consistent-class-order.md#unknownClassOrder) for more details.
84
- * @default 'preserve'
85
- */
86
- unknownOrder?: 'asc' | 'desc' | 'preserve';
87
- /**
88
- * See [official docs](https://github.com/schoero/eslint-plugin-better-tailwindcss/blob/main/docs/rules/enforce-consistent-class-order.md#unknownClassPosition) for more details.
89
- * @default 'start'
90
- */
91
- unknownPosition?: 'start' | 'end';
92
- };
93
- /**
94
- * See [official docs](https://github.com/schoero/eslint-plugin-better-tailwindcss/blob/main/docs/rules/no-restricted-classes.md#restrict) for more details.
95
- * @default []
96
- */
97
- restrict?: string[] | Array<{
98
- pattern: string;
99
- message?: string;
100
- fix?: string;
101
- }>;
102
- /**
103
- * See [official docs](https://github.com/schoero/eslint-plugin-better-tailwindcss/blob/main/docs/rules/no-unknown-classes.md#ignore) for more details.
104
- * @default []
105
- */
106
- ignore?: string[];
107
- whitespace?: {
108
- /**
109
- * See [official docs](https://github.com/schoero/eslint-plugin-better-tailwindcss/blob/main/docs/rules/no-unnecessary-whitespace.md#allowMultiline) for more details.
110
- * @default true
111
- */
112
- allowMultiline?: boolean;
113
- };
114
- };
6
+ //#region src/configs/nextjs.d.ts
7
+ declare const nextjs: (options?: Partial<OxlintOverride$1>) => OxlintOverride$1;
115
8
  //#endregion
116
- //#region src/types/vitest.d.ts
117
- type VitestConfig = {
118
- /**
119
- * A list of glob patterns for your Vitest test files.
120
- */
121
- files: OxlintOverride['files'];
122
- };
9
+ //#region src/configs/playwright.d.ts
10
+ declare const playwright: (options?: Partial<OxlintOverride$1>) => OxlintOverride$1;
123
11
  //#endregion
124
- //#region src/types/config.d.ts
125
- type CustomConfig = {
126
- nextjs?: boolean;
127
- react?: boolean;
128
- tailwindcss?: TailwindCSSConfig;
129
- vitest?: VitestConfig;
130
- playwright?: PlaywrightConfig;
131
- };
132
- type DefineConfigOptions = {
133
- config?: OxlintConfig$1;
134
- custom?: CustomConfig;
135
- };
12
+ //#region src/configs/react.d.ts
13
+ declare const react: (options?: Partial<OxlintOverride$1>) => OxlintOverride$1;
136
14
  //#endregion
137
- //#region src/base.d.ts
138
- declare const defineConfig: ({
139
- config,
140
- custom: userConfig
141
- }?: DefineConfigOptions) => OxlintConfig$1;
15
+ //#region src/configs/tailwindcss.d.ts
16
+ declare const tailwindcss: (options?: Partial<OxlintOverride$1>) => OxlintOverride$1;
17
+ //#endregion
18
+ //#region src/configs/vitest.d.ts
19
+ declare const vitest: (options?: Partial<OxlintOverride$1>) => OxlintOverride$1;
142
20
  //#endregion
143
21
  //#region src/globs.d.ts
144
22
  declare const GLOB_SRC_EXT = "{js,jsx,ts,tsx,cjs,cts,mjs,mts}";
@@ -148,5 +26,5 @@ declare const GLOB_JSX = "**/*.{jsx,cjsx,mjsx}";
148
26
  declare const GLOB_TS = "**/*.{ts,cts,mts}";
149
27
  declare const GLOB_TSX = "**/*.{tsx,ctsx,mtsx}";
150
28
  //#endregion
151
- export { CustomConfig, DefineConfigOptions, GLOB_JS, GLOB_JSX, GLOB_SRC, GLOB_SRC_EXT, GLOB_TS, GLOB_TSX, type OxlintConfig, TailwindCSSConfig, defineConfig };
29
+ export { GLOB_JS, GLOB_JSX, GLOB_SRC, GLOB_SRC_EXT, GLOB_TS, GLOB_TSX, type OxlintConfig, type OxlintOverride, defineConfig, nextjs, playwright, react, tailwindcss, vitest };
152
30
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/types/playwright.ts","../src/types/tailwindcss.ts","../src/types/vitest.ts","../src/types/config.ts","../src/base.ts","../src/globs.ts"],"mappings":";;;;KAEY,gBAAA;;;AAAZ;EAIE,KAAA,EAAO,cAAA;;;;;EAKP,mBAAA;EAKA;;;;EAAA,sBAAA;AAAA;;;KCdU,iBAAA;;;ADAZ;ECIE,UAAA;;;;EAIA,cAAA;EDCA;;;ECGA,QAAA;;;;AAZF;EAiBE,sBAAA;;;;;EAKA,YAAA;EALA;;;EASA,YAAA;EAIY;;;EAAZ,SAAA,GAAY,SAAA;EAEZ,SAAA;IAkBE;;;;IAbA,QAAA;IAwCF;;;;IAnCE,OAAA;EAAA;EAGF,UAAA;IA6CE;;;;IAxCA,KAAA;;AClDJ;;;IDuDI,cAAA;ICnDmB;;;;IDwDnB,iBAAA;IEzDoB;;;;IF8DpB,YAAA;IEzD2B;;;;IF8D3B,eAAA;EAAA;EE/DF;;;;EFsEA,QAAA,cAAsB,KAAA;IAAQ,OAAA;IAAiB,OAAA;IAAkB,GAAA;EAAA;EEhE5C;;;;EFsErB,MAAA;EAEA,UAAA;IExEqB;;;;IF6EnB,cAAA;EAAA;AAAA;;;KC1FQ,YAAA;;;AFAZ;EEIE,KAAA,EAAO,cAAA;AAAA;;;KCDG,YAAA;EACV,MAAA;EACA,KAAA;EACA,WAAA,GAAc,iBAAA;EACd,MAAA,GAAS,YAAA;EACT,UAAA,GAAa,gBAAA;AAAA;AAAA,KAGH,mBAAA;EACV,MAAA,GAAS,cAAA;EACT,MAAA,GAAS,YAAA;AAAA;;;cCiCE,YAAA;EAAgB,MAAA;EAAA,MAAA,EAAA;AAAA,IAA0C,mBAAA,KAA2B,cAAA;;;cChDrF,YAAA;AAAA,cACA,QAAA;AAAA,cAEA,OAAA;AAAA,cACA,QAAA;AAAA,cAEA,OAAA;AAAA,cACA,QAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/base.ts","../src/configs/nextjs.ts","../src/configs/playwright.ts","../src/configs/react.ts","../src/configs/tailwindcss.ts","../src/configs/vitest.ts","../src/globs.ts"],"mappings":";;;cAsBa,YAAA,GAAgB,MAAA,GAAQ,cAAA,KAAoB,cAAA;;;cCd5C,MAAA,GAAU,OAAA,GAAS,OAAA,CAAQ,gBAAA,MAAuB,gBAAA;;;cCAlD,UAAA,GAAc,OAAA,GAAS,OAAA,CAAQ,gBAAA,MAAuB,gBAAA;;;cCAtD,KAAA,GAAS,OAAA,GAAS,OAAA,CAAQ,gBAAA,MAAuB,gBAAA;;;cCAjD,WAAA,GAAe,OAAA,GAAS,OAAA,CAAQ,gBAAA,MAAuB,gBAAA;;;cCAvD,MAAA,GAAU,OAAA,GAAS,OAAA,CAAQ,gBAAA,MAAuB,gBAAA;;;cCRlD,YAAA;AAAA,cACA,QAAA;AAAA,cAEA,OAAA;AAAA,cACA,QAAA;AAAA,cAEA,OAAA;AAAA,cACA,QAAA"}