@lewishowles/lint-config 0.1.3 → 0.2.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 +21 -15
- package/base.json +6 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ Shared oxlint configuration for Lewis Howles projects. One package that every re
|
|
|
8
8
|
bun add -d @lewishowles/lint-config @stylistic/eslint-plugin vite-plus
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
`@stylistic/eslint-plugin` and `vite-plus` are peer dependencies
|
|
11
|
+
`@stylistic/eslint-plugin` and `vite-plus` are peer dependencies: they must be installed in the consuming project so oxlint can resolve the JS plugins from `node_modules`.
|
|
12
12
|
|
|
13
13
|
## Usage
|
|
14
14
|
|
|
@@ -32,7 +32,7 @@ Create a `.oxlintrc.json` in your project root that extends the appropriate laye
|
|
|
32
32
|
}
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
The Vue layer extends `base.json` internally
|
|
35
|
+
The Vue layer extends `base.json` internally, so you only need to extend `vue.json`.
|
|
36
36
|
|
|
37
37
|
## Customising
|
|
38
38
|
|
|
@@ -40,7 +40,7 @@ Your `.oxlintrc.json` stub can override rules, add ignore patterns, add override
|
|
|
40
40
|
|
|
41
41
|
### Overriding a rule
|
|
42
42
|
|
|
43
|
-
To change the severity or options of a rule defined in the shared layer, redeclare it in your stub
|
|
43
|
+
To change the severity or options of a rule defined in the shared layer, redeclare it in your stub: your value wins.
|
|
44
44
|
|
|
45
45
|
```json
|
|
46
46
|
{
|
|
@@ -64,7 +64,7 @@ Ignore patterns are repo-specific, so they always live in your stub:
|
|
|
64
64
|
|
|
65
65
|
### Adding overrides
|
|
66
66
|
|
|
67
|
-
Overrides are additive
|
|
67
|
+
Overrides are additive: shared overrides (if any) still apply, and your local ones are appended.
|
|
68
68
|
|
|
69
69
|
```json
|
|
70
70
|
{
|
|
@@ -84,38 +84,44 @@ Overrides are additive — shared overrides (if any) still apply, and your local
|
|
|
84
84
|
|
|
85
85
|
### Adding plugins
|
|
86
86
|
|
|
87
|
-
Plugins are additive and deduplicated
|
|
87
|
+
Plugins are additive and deduplicated: your local plugins are added to the shared ones. Note that oxlint only supports its built-in plugin names (`oxc`, `typescript`, `unicorn`, `vue`, etc.); there is no `playwright` or `vitest` plugin. Test-file-specific behaviour is handled via `overrides`, not plugins.
|
|
88
88
|
|
|
89
89
|
## Layers
|
|
90
90
|
|
|
91
91
|
| Layer | File | Contents |
|
|
92
92
|
| ------ | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
93
|
-
| `base` | `base.json` | Correctness rules, `@stylistic` formatting rules, `vite-plus/prefer-vite-plus-imports`, `oxc` + `typescript` + `unicorn` plugins, browser env, node env for config files (`vite.config.*`, `vitest.config.*`, `playwright*.config.*`) |
|
|
93
|
+
| `base` | `base.json` | Correctness rules, named-import member sorting, `@stylistic` formatting rules, `vite-plus/prefer-vite-plus-imports`, `oxc` + `typescript` + `unicorn` plugins, browser env, node env for config files (`vite.config.*`, `vitest.config.*`, `playwright*.config.*`) |
|
|
94
94
|
| `vue` | `vue.json` | Extends `base`. Adds `vue` plugin, Vue compiler macros as globals, Vue-specific rules |
|
|
95
95
|
|
|
96
|
+
### Import sorting ownership
|
|
97
|
+
|
|
98
|
+
The base layer sorts named members within each import declaration. It sets `ignoreDeclarationSort: true` because Oxlint reports declaration-row ordering but does not auto-fix it.
|
|
99
|
+
|
|
100
|
+
Consumers that want import declaration rows sorted should enable Oxfmt's `sortImports` option in their local `.oxfmtrc.json`. This keeps member sorting in the shared Oxlint layer and declaration ordering in the formatter that can fix it.
|
|
101
|
+
|
|
96
102
|
## What stays repo-local
|
|
97
103
|
|
|
98
|
-
- `ignorePatterns
|
|
99
|
-
- `overrides` for repo-specific directories (e.g. `bin/**/*.js`, `src/cli/**/*.js`, `src/playwright/**/*.js`)
|
|
104
|
+
- `ignorePatterns`, since every repo has different build output and tool directories
|
|
105
|
+
- `overrides` for repo-specific directories (e.g. `bin/**/*.js`, `src/cli/**/*.js`, `src/playwright/**/*.js`), since the file paths differ per repo and can't be generalised
|
|
100
106
|
- Test-file rule relaxations (e.g. turning off `vite-plus/prefer-vite-plus-imports` in `*.d.ts`)
|
|
101
|
-
- Additional plugins
|
|
107
|
+
- Additional plugins, only for repos that need them
|
|
102
108
|
|
|
103
109
|
## Merge semantics
|
|
104
110
|
|
|
105
111
|
When a consumer stub extends a shared layer:
|
|
106
112
|
|
|
107
|
-
- **Rules** shallow-merge by key
|
|
108
|
-
- **Overrides** are additive
|
|
109
|
-
- **Plugins** are additive
|
|
113
|
+
- **Rules** shallow-merge by key: the consumer's value wins for any rule defined in both
|
|
114
|
+
- **Overrides** are additive: both shared and local `overrides` entries apply, including any `env` declared inside an override block
|
|
115
|
+
- **Plugins** are additive: both shared and local `plugins`/`jsPlugins` are loaded (deduplicated)
|
|
110
116
|
|
|
111
117
|
### Known oxlint limitation: top-level `env`, `globals`, and `ignorePatterns` don't merge through `extends`
|
|
112
118
|
|
|
113
|
-
oxlint currently drops top-level `env`, `globals`, and `ignorePatterns` from an extended config file entirely
|
|
119
|
+
oxlint currently drops top-level `env`, `globals`, and `ignorePatterns` from an extended config file entirely: they only take effect if declared directly in the file oxlint is invoked with. This is an open upstream bug: [oxc-project/oxc#20087](https://github.com/oxc-project/oxc/issues/20087) (open as of oxlint 1.72.0).
|
|
114
120
|
|
|
115
121
|
In practice this means:
|
|
116
122
|
|
|
117
|
-
- `base.json`'s `env` (`builtin`, `browser`) and `vue.json`'s Vue macro `globals` (`defineProps`, `defineEmits`, etc.) will **not** reach a consumer that only does `{ "extends": ["./node_modules/@lewishowles/lint-config/vue.json"] }
|
|
118
|
-
- Any `ignorePatterns` this package might declare would be silently dropped the same way, so it deliberately ships none
|
|
123
|
+
- `base.json`'s `env` (`builtin`, `browser`) and `vue.json`'s Vue macro `globals` (`defineProps`, `defineEmits`, etc.) will **not** reach a consumer that only does `{ "extends": ["./node_modules/@lewishowles/lint-config/vue.json"] }`: every global from the shared layer will be flagged by `no-undef`.
|
|
124
|
+
- Any `ignorePatterns` this package might declare would be silently dropped the same way, so it deliberately ships none. See "What stays repo-local" below.
|
|
119
125
|
|
|
120
126
|
Until this is fixed upstream, redeclare the `env`/`globals` you need directly in your project's `.oxlintrc.json`, even though `base.json`/`vue.json` already declare them:
|
|
121
127
|
|
package/base.json
CHANGED
|
@@ -25,6 +25,12 @@
|
|
|
25
25
|
"no-unexpected-multiline": "error",
|
|
26
26
|
"no-useless-assignment": "error",
|
|
27
27
|
"preserve-caught-error": "error",
|
|
28
|
+
"sort-imports": [
|
|
29
|
+
"error",
|
|
30
|
+
{
|
|
31
|
+
"ignoreDeclarationSort": true
|
|
32
|
+
}
|
|
33
|
+
],
|
|
28
34
|
|
|
29
35
|
"@stylistic/no-confusing-arrow": "error",
|
|
30
36
|
"@stylistic/padding-line-between-statements": [
|