@nelsonlaidev/oxlint-config 0.4.0 → 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,7 +1,7 @@
1
1
  # @nelsonlaidev/oxlint-config
2
2
 
3
- [![Version](https://img.shields.io/npm/v/@nelsonlaidev/oxlint-config?style=flat&colorA=111111&colorB=000000)](https://npmx.dev/package/@nelsonlaidev/oxlint-config)
4
- [![Downloads](https://img.shields.io/npm/dt/@nelsonlaidev/oxlint-config.svg?style=flat&colorA=222222&colorB=000000)](https://npmx.dev/package/@nelsonlaidev/oxlint-config)
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
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
6
 
7
7
  Personal Oxlint configurations for Nelson Lai projects.
@@ -27,13 +27,53 @@ Create an `oxlint.config.ts` file with the following content:
27
27
  ```ts
28
28
  import { defineConfig } from '@nelsonlaidev/oxlint-config'
29
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
+
30
38
  export default defineConfig({
31
- config: {
32
- // Custom OxLint configuration options
33
- },
34
- custom: {
35
- react: true,
39
+ settings: {
40
+ 'better-tailwindcss': {
41
+ entryPoint: './src/globals.css',
42
+ },
36
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
+ ],
37
77
  })
38
78
  ```
39
79
 
@@ -65,13 +105,13 @@ This config includes opinionated rules from the following plugins:
65
105
  - `sonarjs`
66
106
  - `import-sort`
67
107
 
68
- #### Conditionally enabled
108
+ #### Optional presets
69
109
 
70
- - `react` — auto-detected or via `react` option
71
- - `nextjs` — auto-detected or via `nextjs` option
72
- - `vitest` — via `vitest` option
73
- - `playwright` — via `playwright` option
74
- - `tailwindcss` — via `tailwindcss` option
110
+ - `react`
111
+ - `nextjs`
112
+ - `vitest`
113
+ - `playwright`
114
+ - `tailwindcss`
75
115
 
76
116
  ## Migration Status
77
117
 
@@ -93,11 +133,11 @@ This config includes opinionated rules from the following plugins:
93
133
  | `node/nelsonlaidev/node/rules` | 2 | 4 | 4 | 0 | 50.0% |
94
134
  | `playwright/nelsonlaidev/playwright/rules` | 36 | 0 | 0 | 0 | 100.0% |
95
135
  | `promise/nelsonlaidev/promise/rules` | 16 | 1 | 1 | 0 | 100.0% |
96
- | `react/nelsonlaidev/react/rules` | 99 | 0 | 0 | 0 | 100.0% |
136
+ | `react/nelsonlaidev/react/rules` | 99 | 2 | 2 | 0 | 100.0% |
97
137
  | `regexp/nelsonlaidev/regexp/rules` | 67 | 0 | 0 | 0 | 100.0% |
98
138
  | `sonarjs/nelsonlaidev/sonarjs/rules` | 268 | 0 | 0 | 0 | 100.0% |
99
139
  | `stylistic/nelsonlaidev/stylistic/rules` | 1 | 0 | 0 | 0 | 100.0% |
100
- | `tailwindcss/nelsonlaidev/tailwindcss/rules` | 12 | 0 | 0 | 0 | 100.0% |
140
+ | `tailwindcss/nelsonlaidev/tailwindcss/rules` | 9 | 0 | 0 | 0 | 100.0% |
101
141
  | `typescript/nelsonlaidev/typescript/rules` | 117 | 21 | 21 | 0 | 100.0% |
102
142
  | `typescript/nelsonlaidev/typescript/declarations` | 2 | 0 | 0 | 0 | 100.0% |
103
143
  | `unicorn/nelsonlaidev/unicorn/rules` | 134 | 195 | 195 | 0 | 41.0% |
package/dist/index.d.mts CHANGED
@@ -1,148 +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#cwd) for more details.
38
- */
39
- cwd?: string;
40
- /**
41
- * See [official docs](https://github.com/schoero/eslint-plugin-better-tailwindcss/blob/main/docs/settings/settings.md#detectcomponentclasses) for more details.
42
- * @default false
43
- */
44
- detectComponentClasses?: boolean;
45
- /**
46
- * See [official docs](https://github.com/schoero/eslint-plugin-better-tailwindcss/blob/main/docs/settings/settings.md#rootfontsize) for more details.
47
- * @default 16
48
- */
49
- rootFontSize?: number;
50
- /**
51
- * See [official docs](https://github.com/schoero/eslint-plugin-better-tailwindcss/blob/main/docs/settings/settings.md#messagestyle) for more details.
52
- */
53
- messageStyle?: 'visual' | 'compact' | 'raw';
54
- /**
55
- * See [official docs](https://github.com/schoero/eslint-plugin-better-tailwindcss/blob/main/docs/settings/settings.md#selectors) for more details.
56
- */
57
- selectors?: Selectors;
58
- canonical?: {
59
- /**
60
- * See [official docs](https://github.com/schoero/eslint-plugin-better-tailwindcss/blob/main/docs/rules/enforce-canonical-classes.md#collapse) for more details.
61
- * @default true
62
- */
63
- collapse?: boolean;
64
- /**
65
- * See [official docs](https://github.com/schoero/eslint-plugin-better-tailwindcss/blob/main/docs/rules/enforce-canonical-classes.md#logical) for more details.
66
- * @default true
67
- */
68
- logical?: boolean;
69
- };
70
- classOrder?: {
71
- /**
72
- * See [official docs](https://github.com/schoero/eslint-plugin-better-tailwindcss/blob/main/docs/rules/enforce-consistent-class-order.md#order) for more details.
73
- * @default 'official'
74
- */
75
- order?: 'asc' | 'desc' | 'official' | 'strict';
76
- /**
77
- * See [official docs](https://github.com/schoero/eslint-plugin-better-tailwindcss/blob/main/docs/rules/enforce-consistent-class-order.md#componentClassOrder) for more details.
78
- * @default 'preserve'
79
- */
80
- componentOrder?: 'asc' | 'desc' | 'preserve';
81
- /**
82
- * See [official docs](https://github.com/schoero/eslint-plugin-better-tailwindcss/blob/main/docs/rules/enforce-consistent-class-order.md#componentClassPosition) for more details.
83
- * @default 'start'
84
- */
85
- componentPosition?: 'start' | 'end';
86
- /**
87
- * See [official docs](https://github.com/schoero/eslint-plugin-better-tailwindcss/blob/main/docs/rules/enforce-consistent-class-order.md#unknownClassOrder) for more details.
88
- * @default 'preserve'
89
- */
90
- unknownOrder?: 'asc' | 'desc' | 'preserve';
91
- /**
92
- * See [official docs](https://github.com/schoero/eslint-plugin-better-tailwindcss/blob/main/docs/rules/enforce-consistent-class-order.md#unknownClassPosition) for more details.
93
- * @default 'start'
94
- */
95
- unknownPosition?: 'start' | 'end';
96
- };
97
- /**
98
- * See [official docs](https://github.com/schoero/eslint-plugin-better-tailwindcss/blob/main/docs/rules/no-restricted-classes.md#restrict) for more details.
99
- * @default []
100
- */
101
- restrict?: string[] | Array<{
102
- pattern: string;
103
- message?: string;
104
- fix?: string;
105
- }>;
106
- /**
107
- * See [official docs](https://github.com/schoero/eslint-plugin-better-tailwindcss/blob/main/docs/rules/no-unknown-classes.md#ignore) for more details.
108
- * @default []
109
- */
110
- ignore?: string[];
111
- whitespace?: {
112
- /**
113
- * See [official docs](https://github.com/schoero/eslint-plugin-better-tailwindcss/blob/main/docs/rules/no-unnecessary-whitespace.md#allowMultiline) for more details.
114
- * @default true
115
- */
116
- allowMultiline?: boolean;
117
- };
118
- };
6
+ //#region src/configs/nextjs.d.ts
7
+ declare const nextjs: (options?: Partial<OxlintOverride$1>) => OxlintOverride$1;
119
8
  //#endregion
120
- //#region src/types/vitest.d.ts
121
- type VitestConfig = {
122
- /**
123
- * A list of glob patterns for your Vitest test files.
124
- */
125
- files: OxlintOverride['files'];
126
- };
9
+ //#region src/configs/playwright.d.ts
10
+ declare const playwright: (options?: Partial<OxlintOverride$1>) => OxlintOverride$1;
127
11
  //#endregion
128
- //#region src/types/config.d.ts
129
- type CustomConfig = {
130
- nextjs?: boolean;
131
- react?: boolean;
132
- tailwindcss?: TailwindCSSConfig;
133
- vitest?: VitestConfig;
134
- playwright?: PlaywrightConfig;
135
- };
136
- type DefineConfigOptions = {
137
- config?: OxlintConfig$1;
138
- custom?: CustomConfig;
139
- };
12
+ //#region src/configs/react.d.ts
13
+ declare const react: (options?: Partial<OxlintOverride$1>) => OxlintOverride$1;
140
14
  //#endregion
141
- //#region src/base.d.ts
142
- declare const defineConfig: ({
143
- config,
144
- custom: userConfig
145
- }?: 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;
146
20
  //#endregion
147
21
  //#region src/globs.d.ts
148
22
  declare const GLOB_SRC_EXT = "{js,jsx,ts,tsx,cjs,cts,mjs,mts}";
@@ -152,5 +26,5 @@ declare const GLOB_JSX = "**/*.{jsx,cjsx,mjsx}";
152
26
  declare const GLOB_TS = "**/*.{ts,cts,mts}";
153
27
  declare const GLOB_TSX = "**/*.{tsx,ctsx,mtsx}";
154
28
  //#endregion
155
- 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 };
156
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;;;;EAIA,GAAA;EAhB2B;;;;EAqB3B,sBAAA;EATA;;;;EAcA,YAAA;EAQA;;;EAJA,YAAA;EAgBE;;;EAZF,SAAA,GAAY,SAAA;EAEZ,SAAA;IAiCE;;;;IA5BA,QAAA;IAwC6C;;;;IAnC7C,OAAA;EAAA;EAGF,UAAA;;;;ACjDF;IDsDI,KAAA;IClDK;;;;IDuDL,cAAA;;AExDJ;;;IF6DI,iBAAA;IEzDO;;;;IF8DP,YAAA;IEhEF;;;;IFqEE,eAAA;EAAA;EElEW;;;AAGf;EFsEE,QAAA,cAAsB,KAAA;IAAQ,OAAA;IAAiB,OAAA;IAAkB,GAAA;EAAA;EEpEjE;;;;EF0EA,MAAA;EAEA,UAAA;;AGrDF;;;IH0DI,cAAA;EAAA;AAAA;;;KC9FQ,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;;;cCuBE,YAAA;EAAgB,MAAA;EAAA,MAAA,EAAA;AAAA,IAA0C,mBAAA,KAA2B,cAAA;;;cCtCrF,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"}