@st1ggy/linter-config 5.0.0 → 6.3.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 +38 -44
- package/{packages/eslint/data → data}/linter-config-inventory.json +3 -3
- package/docs/RULE_MAPPING.md +38 -0
- package/index.d.ts +0 -32
- package/package.json +43 -80
- package/scripts/README.md +23 -18
- package/scripts/init-common.sh +6 -0
- package/scripts/init-next.sh +5 -0
- package/scripts/init-react.sh +5 -0
- package/scripts/init-svelte.sh +5 -0
- package/{packages/eslint/scripts → scripts}/inventory.mjs +5 -5
- package/scripts/linter-init-core.mjs +317 -0
- package/scripts/linter-init.mjs +243 -0
- package/scripts/remove-current.sh +17 -0
- package/packages/biome/LICENSE +0 -201
- package/packages/biome/biome.json +0 -5
- package/packages/biome/configs/biome.common.json +0 -44
- package/packages/biome/configs/biome.next.json +0 -10
- package/packages/biome/configs/biome.react.json +0 -12
- package/packages/biome/configs/biome.svelte.json +0 -23
- package/packages/biome/docs/README.md +0 -29
- package/packages/eslint/docs/RULE_MAPPING.md +0 -50
- package/packages/eslint/scripts/init-common.sh +0 -4
- package/packages/eslint/scripts/init-next.sh +0 -4
- package/packages/eslint/scripts/init-react.sh +0 -4
- package/packages/eslint/scripts/init-svelte.sh +0 -4
- package/packages/eslint/scripts/linter-init.mjs +0 -209
- package/packages/eslint/scripts/remove-current.sh +0 -12
- /package/{packages/eslint/src → src}/eslint/configs/config.common.js +0 -0
- /package/{packages/eslint/src → src}/eslint/configs/config.gitignore.js +0 -0
- /package/{packages/eslint/src → src}/eslint/configs/config.import.js +0 -0
- /package/{packages/eslint/src → src}/eslint/configs/config.next.js +0 -0
- /package/{packages/eslint/src → src}/eslint/configs/config.prettier.js +0 -0
- /package/{packages/eslint/src → src}/eslint/configs/config.react.js +0 -0
- /package/{packages/eslint/src → src}/eslint/configs/config.sonarjs.js +0 -0
- /package/{packages/eslint/src → src}/eslint/configs/config.typescript.js +0 -0
- /package/{packages/eslint/src → src}/eslint/configs/config.unicorn.js +0 -0
- /package/{packages/eslint/src → src}/eslint/configs/constants.js +0 -0
- /package/{packages/eslint/src → src}/eslint/configs/svelte-stack.js +0 -0
- /package/{packages/eslint/src → src}/eslint/eslint-svelte.config.js +0 -0
- /package/{packages/eslint/src → src}/eslint/eslint.config.common.js +0 -0
- /package/{packages/eslint/src → src}/eslint/eslint.config.next.js +0 -0
- /package/{packages/eslint/src → src}/eslint/eslint.config.react.js +0 -0
- /package/{packages/eslint/src → src}/examples/example.scss +0 -0
- /package/{packages/eslint/src → src}/examples/example.svelte +0 -0
- /package/{packages/eslint/src → src}/examples/example.ts +0 -0
- /package/{packages/eslint/src → src}/index.js +0 -0
- /package/{packages/eslint/src → src}/prettier/prettier-svelte.config.js +0 -0
- /package/{packages/eslint/src → src}/prettier/prettier.config.common.js +0 -0
- /package/{packages/eslint/src → src}/stylelint/stylelint.config.scss.js +0 -0
package/README.md
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
# st1ggy/linter-config
|
|
2
2
|
|
|
3
|
-
Single npm package **`@st1ggy/linter-config`** with **subpath exports**.
|
|
4
|
-
|
|
5
|
-
| Path | Contents |
|
|
6
|
-
| --- | --- |
|
|
7
|
-
| [`packages/eslint`](packages/eslint) | ESLint, Prettier, Stylelint configs |
|
|
8
|
-
| [`packages/biome`](packages/biome) | Biome JSON presets and [`docs/README.md`](packages/biome/docs/README.md) |
|
|
3
|
+
Single npm package **`@st1ggy/linter-config`** with **subpath exports**. Config sources live under [`src/`](src/) (ESLint, Prettier, Stylelint).
|
|
9
4
|
|
|
10
5
|
Install once:
|
|
11
6
|
|
|
@@ -13,66 +8,69 @@ Install once:
|
|
|
13
8
|
npm i -D @st1ggy/linter-config
|
|
14
9
|
```
|
|
15
10
|
|
|
16
|
-
Add
|
|
11
|
+
Add **`eslint`**, **`prettier`**, **`stylelint`**, and framework peers only for the stacks you use (see `peerDependencies` in [`package.json`](package.json)).
|
|
17
12
|
|
|
18
13
|
### Generate local wrapper configs
|
|
19
14
|
|
|
20
|
-
The
|
|
21
|
-
|
|
22
|
-
Pick **at least one** of:
|
|
15
|
+
The published CLI is invoked as **`@st1ggy/linter-config`** (see [`package.json`](package.json) `bin`). Each run writes **`eslint.config.js`**, **`prettier.config.js`**, and **`stylelint.config.js`** as ESM re-exports for one stack.
|
|
23
16
|
|
|
24
|
-
|
|
25
|
-
- **`--biome`** — writes `biome.json`.
|
|
17
|
+
Unless **`--skip-install`** is passed: if **`package.json`** exists in the target directory and **`@st1ggy/linter-config`** is not yet resolvable from **`node_modules`** (search walks up to the filesystem root, for hoisted monorepos), the CLI runs the detected package manager (**npm** / **pnpm** / **yarn** / **bun** from the nearest lockfile) to **`add -D @st1ggy/linter-config`** or **`install`** when the dependency is already listed but `node_modules` is missing.
|
|
26
18
|
|
|
27
19
|
Pick **at most one** stack flag (default **`--common`** if you omit all four):
|
|
28
20
|
|
|
29
21
|
**`--common` · `--react` · `--next` · `--svelte`**
|
|
30
22
|
|
|
31
|
-
|
|
23
|
+
**After** `npm i -D @st1ggy/linter-config`:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npx @st1ggy/linter-config init
|
|
27
|
+
npx @st1ggy/linter-config init --react
|
|
28
|
+
npx @st1ggy/linter-config reinit --svelte --dir ./apps/web
|
|
29
|
+
npm exec @st1ggy/linter-config -- init --common
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**Without** installing the dependency first (`npx` will fetch **`@st1ggy/linter-config`**):
|
|
32
33
|
|
|
33
34
|
```bash
|
|
34
|
-
npx linter-config init
|
|
35
|
-
npx linter-config init --
|
|
36
|
-
npx linter-config
|
|
37
|
-
npx linter-config reinit --eslint --react --dir ./apps/web
|
|
35
|
+
npx --yes @st1ggy/linter-config init
|
|
36
|
+
npx --yes @st1ggy/linter-config init --react
|
|
37
|
+
npx --yes @st1ggy/linter-config reinit --svelte --dir ./apps/web
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
+
Older **`--eslint`** on the command line is still accepted for compatibility; **`--eslint`** is optional.
|
|
41
|
+
|
|
40
42
|
- **`init` / `create`** — create only missing files (skip existing).
|
|
41
|
-
- **`reinit`** — overwrite
|
|
43
|
+
- **`reinit`** — overwrite the three wrapper configs (same names; nothing to delete first).
|
|
44
|
+
|
|
45
|
+
**Legacy filenames** (`.eslintrc.*`, `prettier.config.cjs`, extra copies, …) are **not** removed by `init` / `reinit`. For an **interactive** cleanup in the project root, use [`scripts/remove-current.sh`](scripts/remove-current.sh) (published inside the package under `scripts/`). In this repo: `npm run config:remove-current`. Run it **before** `init` / `reinit` if you need to drop stray configs; it is intentionally **not** wired into `reinit` so CI stays non-interactive.
|
|
42
46
|
|
|
43
47
|
Your project should use **`"type": "module"`** (or `.mjs` config filenames) so the generated ESM re-exports load.
|
|
44
48
|
|
|
45
|
-
In this monorepo, `npm run config:init
|
|
49
|
+
In this monorepo, `npm run config:init` / `config:reinit` / `config:create` run **`node ./scripts/linter-init.mjs … --dir ./examples/init-smoke`** (see [`scripts/README.md`](scripts/README.md)). The CLI **refuses** to write consumer stubs in the package root (`package.json` name `@st1ggy/linter-config`) so this repository’s dev configs are not overwritten.
|
|
46
50
|
|
|
47
51
|
## Subpath imports
|
|
48
52
|
|
|
49
|
-
**ESLint / Prettier / Stylelint**
|
|
50
|
-
|
|
51
53
|
```js
|
|
52
54
|
import eslintReact from '@st1ggy/linter-config/eslint-react'
|
|
53
55
|
import prettierCommon from '@st1ggy/linter-config/prettier-common'
|
|
54
56
|
import stylelintScss from '@st1ggy/linter-config/stylelint-scss'
|
|
55
57
|
```
|
|
56
58
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
Use package subpaths such as `@st1ggy/linter-config/biome-common`, `@st1ggy/linter-config/biome-react`, `@st1ggy/linter-config/biome-next`, `@st1ggy/linter-config/biome-svelte`, or the root Biome entry `@st1ggy/linter-config/biome`.
|
|
60
|
-
|
|
61
|
-
The barrel export `@st1ggy/linter-config` re-exports ESLint/Prettier/Stylelint presets only (see [`packages/eslint/src/index.js`](packages/eslint/src/index.js)).
|
|
59
|
+
The barrel export `@st1ggy/linter-config` re-exports ESLint/Prettier/Stylelint presets only (see [`src/index.js`](src/index.js)).
|
|
62
60
|
|
|
63
61
|
### Migration (Stylelint)
|
|
64
62
|
|
|
65
63
|
If you previously used Stylelint 16 with this preset, upgrade the consumer to **Stylelint 17** before depending on the latest release.
|
|
66
64
|
|
|
67
|
-
### Migration
|
|
65
|
+
### Migration from Biome presets
|
|
68
66
|
|
|
69
|
-
|
|
67
|
+
**v6** removes all **`@st1ggy/linter-config/biome`** and **`biome-*`** subpath exports. Use [Biome](https://biomejs.dev/) in your project directly with its own `biome.json`, or stay on ESLint + Prettier + Stylelint via this package.
|
|
70
68
|
|
|
71
69
|
### Development of this package
|
|
72
70
|
|
|
73
71
|
`npm install` uses [`.npmrc`](.npmrc) `legacy-peer-deps=true` (see earlier notes on `eslint-import-resolver-custom-alias`).
|
|
74
72
|
|
|
75
|
-
**Publishing:** this repo’s **root** `package.json` is the published `@st1ggy/linter-config
|
|
73
|
+
**Publishing:** this repo’s **root** `package.json` is the published `@st1ggy/linter-config`:
|
|
76
74
|
|
|
77
75
|
```bash
|
|
78
76
|
npm run publish:npm
|
|
@@ -82,7 +80,7 @@ npm run publish:npm
|
|
|
82
80
|
|
|
83
81
|
## Toolchain (this repo)
|
|
84
82
|
|
|
85
|
-
There is **one** published package
|
|
83
|
+
There is **one** published package at the **repository root** (no `packages/` workspace layout).
|
|
86
84
|
|
|
87
85
|
```bash
|
|
88
86
|
npm install
|
|
@@ -93,20 +91,16 @@ npm run lint
|
|
|
93
91
|
|
|
94
92
|
| Command | What it runs |
|
|
95
93
|
| --- | --- |
|
|
96
|
-
| `npm run lint` |
|
|
97
|
-
| `npm run lint:eslint` |
|
|
98
|
-
| `npm run lint:stylelint` |
|
|
99
|
-
| `npm run lint:prettier` |
|
|
100
|
-
| `npm run lint:
|
|
101
|
-
| `npm run
|
|
102
|
-
| `npm run
|
|
103
|
-
| `npm run
|
|
104
|
-
| `npm run
|
|
105
|
-
| `npm run config:
|
|
106
|
-
| `npm run config:reinit` | `reinit` with the same flags (overwrite) |
|
|
107
|
-
| `npm run config:create` | Same as `config:init` (alternate script name) |
|
|
108
|
-
|
|
109
|
-
Inside a workspace you can also run the same scripts locally, e.g. `npm run lint --workspace=packages/eslint` or `cd packages/biome && npm run lint`.
|
|
94
|
+
| `npm run lint` | ESLint + Stylelint (`src/**/*.scss` / `.css`) + Prettier check |
|
|
95
|
+
| `npm run lint:eslint` | ESLint only |
|
|
96
|
+
| `npm run lint:stylelint` | Stylelint only |
|
|
97
|
+
| `npm run lint:prettier` | Prettier `--check` only |
|
|
98
|
+
| `npm run lint:fix` | Auto-fix ESLint, Stylelint, Prettier |
|
|
99
|
+
| `npm run inventory` | Regenerate [`data/linter-config-inventory.json`](data/linter-config-inventory.json) |
|
|
100
|
+
| `npm run config:init` | `node ./scripts/linter-init.mjs init --common --dir ./examples/init-smoke` (skip existing); see [`scripts/README.md`](scripts/README.md) |
|
|
101
|
+
| `npm run config:reinit` | same target, overwrite |
|
|
102
|
+
| `npm run config:create` | same as `config:init` |
|
|
103
|
+
| `npm run config:remove-current` | interactive: offer to delete `*eslint*` / `*stylelint*` / `*prettier*` files in cwd (see [scripts/remove-current.sh](scripts/remove-current.sh)) |
|
|
110
104
|
|
|
111
105
|
## Optional ESLint add-ons
|
|
112
106
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"generatedAt": "2026-04-
|
|
3
|
-
"source": "@st1ggy/linter-config@
|
|
4
|
-
"linterConfigRoot": "/Users/dnbragin/Projects/personal/linter-config
|
|
2
|
+
"generatedAt": "2026-04-10T20:01:50.950Z",
|
|
3
|
+
"source": "@st1ggy/linter-config@6.3.0 (local tree)",
|
|
4
|
+
"linterConfigRoot": "/Users/dnbragin/Projects/personal/linter-config",
|
|
5
5
|
"flatConfigs": {
|
|
6
6
|
"eslint-common": {
|
|
7
7
|
"module": "src/eslint/eslint.config.common.js",
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Preset layers (`@st1ggy/linter-config`)
|
|
2
|
+
|
|
3
|
+
This document is the **high-level matrix** of how flat-config and Stylelint presets are layered. The machine-readable inventory (every flat-config rule id and Stylelint rule name with effective severity for sample files) lives in [`../data/linter-config-inventory.json`](../data/linter-config-inventory.json). Regenerate it from a checkout of this repo with:
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
node scripts/inventory.mjs
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
(`LINTER_CONFIG_ROOT` overrides the default repository root.)
|
|
10
|
+
|
|
11
|
+
## Flat-config layers
|
|
12
|
+
|
|
13
|
+
| Layer | `@st1ggy/linter-config` preset | Notes |
|
|
14
|
+
| --- | --- | --- |
|
|
15
|
+
| Base + stylistic | `eslint-common` (`config.common.js`, `@eslint/js` recommended, `@stylistic` all + overrides) | Foundation for TS/JS. |
|
|
16
|
+
| TypeScript | `config.typescript.js` | typescript-eslint integration. |
|
|
17
|
+
| Imports | `config.import.js` (import-x) | Resolver and import ordering. |
|
|
18
|
+
| Prettier-in-ESLint | `config.prettier.js` | eslint-plugin-prettier + config-prettier. |
|
|
19
|
+
| Unicorn | `config.unicorn.js` | eslint-plugin-unicorn. |
|
|
20
|
+
| SonarJS | `config.sonarjs.js` | eslint-plugin-sonarjs. |
|
|
21
|
+
| React | `config.react.js` | React/JSX + hooks. |
|
|
22
|
+
| Next.js | `config.next.js` | `@next/eslint-plugin-next`. |
|
|
23
|
+
| Svelte | `svelte-stack.js` | `eslint-plugin-svelte` flat recommended + TS parser options. |
|
|
24
|
+
|
|
25
|
+
Inventory rule counts (sample files in this repository):
|
|
26
|
+
|
|
27
|
+
- `eslint-common`: effective rules on `src/examples/example.ts`
|
|
28
|
+
- `eslint-react`: includes React layer on the same sample
|
|
29
|
+
- `eslint-next`: Next layer on the same sample
|
|
30
|
+
- `eslint-svelte`: effective rules on `src/examples/example.svelte`
|
|
31
|
+
|
|
32
|
+
## Stylelint (SCSS preset)
|
|
33
|
+
|
|
34
|
+
| Layer | `@st1ggy/linter-config` | Notes |
|
|
35
|
+
| --- | --- | --- |
|
|
36
|
+
| SCSS stack | `stylelint.config.scss.js` (recommended + scss + sass-guidelines + clean-order + plugins) | Full Stylelint stack for SCSS. |
|
|
37
|
+
|
|
38
|
+
Inventory: Stylelint rule entries after `extends` resolution on `src/examples/example.scss`.
|
package/index.d.ts
CHANGED
|
@@ -57,35 +57,3 @@ declare module '@st1ggy/linter-config/stylelint-scss' {
|
|
|
57
57
|
|
|
58
58
|
export default config
|
|
59
59
|
}
|
|
60
|
-
|
|
61
|
-
type BiomeJsonConfig = Record<string, unknown>
|
|
62
|
-
|
|
63
|
-
declare module '@st1ggy/linter-config/biome' {
|
|
64
|
-
const config: BiomeJsonConfig
|
|
65
|
-
|
|
66
|
-
export default config
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
declare module '@st1ggy/linter-config/biome-common' {
|
|
70
|
-
const config: BiomeJsonConfig
|
|
71
|
-
|
|
72
|
-
export default config
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
declare module '@st1ggy/linter-config/biome-react' {
|
|
76
|
-
const config: BiomeJsonConfig
|
|
77
|
-
|
|
78
|
-
export default config
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
declare module '@st1ggy/linter-config/biome-next' {
|
|
82
|
-
const config: BiomeJsonConfig
|
|
83
|
-
|
|
84
|
-
export default config
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
declare module '@st1ggy/linter-config/biome-svelte' {
|
|
88
|
-
const config: BiomeJsonConfig
|
|
89
|
-
|
|
90
|
-
export default config
|
|
91
|
-
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@st1ggy/linter-config",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "ESLint, Prettier,
|
|
3
|
+
"version": "6.3.0",
|
|
4
|
+
"description": "ESLint, Prettier, and Stylelint shareable configs (sources under src/).",
|
|
5
5
|
"private": false,
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -10,8 +10,7 @@
|
|
|
10
10
|
"keywords": [
|
|
11
11
|
"eslint",
|
|
12
12
|
"prettier",
|
|
13
|
-
"stylelint"
|
|
14
|
-
"biome"
|
|
13
|
+
"stylelint"
|
|
15
14
|
],
|
|
16
15
|
"author": "Dmitrii Bragin (st1ggy)",
|
|
17
16
|
"license": "Apache-2.0",
|
|
@@ -20,14 +19,16 @@
|
|
|
20
19
|
},
|
|
21
20
|
"homepage": "https://github.com/St1ggy/linter-config/tree/main#readme",
|
|
22
21
|
"bin": {
|
|
23
|
-
"linter-config": "
|
|
22
|
+
"@st1ggy/linter-config": "./scripts/linter-init.mjs"
|
|
24
23
|
},
|
|
25
24
|
"dependencies": {
|
|
26
|
-
"@next/eslint-plugin-next": "^16.2.3",
|
|
27
25
|
"@eslint/compat": "^2.0.5",
|
|
28
26
|
"@eslint/js": "^10.0.1",
|
|
27
|
+
"@inquirer/core": "^10.3.2",
|
|
28
|
+
"@inquirer/prompts": "^7.10.1",
|
|
29
|
+
"@next/eslint-plugin-next": "^16.2.3",
|
|
29
30
|
"@stylistic/eslint-plugin": "^5.10.0",
|
|
30
|
-
"eslint": "^10.
|
|
31
|
+
"eslint": "^9.0.0 || ^10.0.0",
|
|
31
32
|
"eslint-config-prettier": "^10.1.8",
|
|
32
33
|
"eslint-import-resolver-custom-alias": "^1.3.2",
|
|
33
34
|
"eslint-import-resolver-typescript": "^4.4.4",
|
|
@@ -39,9 +40,11 @@
|
|
|
39
40
|
"eslint-plugin-svelte": "^3.17.0",
|
|
40
41
|
"eslint-plugin-unicorn": "^64.0.0",
|
|
41
42
|
"find-up-simple": "^1.0.1",
|
|
42
|
-
"
|
|
43
|
+
"minimist": "^1.2.8",
|
|
44
|
+
"ora": "^8.2.0",
|
|
45
|
+
"prettier": "^3.0.0",
|
|
43
46
|
"prettier-plugin-svelte": "^3.5.1",
|
|
44
|
-
"stylelint": "^17.
|
|
47
|
+
"stylelint": "^17.0.0",
|
|
45
48
|
"stylelint-config-clean-order": "^8.0.1",
|
|
46
49
|
"stylelint-config-recommended": "^18.0.0",
|
|
47
50
|
"stylelint-config-recommended-scss": "^17.0.1",
|
|
@@ -58,105 +61,69 @@
|
|
|
58
61
|
"exports": {
|
|
59
62
|
".": {
|
|
60
63
|
"types": "./index.d.ts",
|
|
61
|
-
"import": "./
|
|
62
|
-
"default": "./
|
|
64
|
+
"import": "./src/index.js",
|
|
65
|
+
"default": "./src/index.js"
|
|
63
66
|
},
|
|
64
67
|
"./eslint-next": {
|
|
65
68
|
"types": "./index.d.ts",
|
|
66
|
-
"import": "./
|
|
67
|
-
"default": "./
|
|
69
|
+
"import": "./src/eslint/eslint.config.next.js",
|
|
70
|
+
"default": "./src/eslint/eslint.config.next.js"
|
|
68
71
|
},
|
|
69
72
|
"./eslint-react": {
|
|
70
73
|
"types": "./index.d.ts",
|
|
71
|
-
"import": "./
|
|
72
|
-
"default": "./
|
|
74
|
+
"import": "./src/eslint/eslint.config.react.js",
|
|
75
|
+
"default": "./src/eslint/eslint.config.react.js"
|
|
73
76
|
},
|
|
74
77
|
"./eslint-svelte": {
|
|
75
78
|
"types": "./index.d.ts",
|
|
76
|
-
"import": "./
|
|
77
|
-
"default": "./
|
|
79
|
+
"import": "./src/eslint/eslint-svelte.config.js",
|
|
80
|
+
"default": "./src/eslint/eslint-svelte.config.js"
|
|
78
81
|
},
|
|
79
82
|
"./eslint-common": {
|
|
80
83
|
"types": "./index.d.ts",
|
|
81
|
-
"import": "./
|
|
82
|
-
"default": "./
|
|
84
|
+
"import": "./src/eslint/eslint.config.common.js",
|
|
85
|
+
"default": "./src/eslint/eslint.config.common.js"
|
|
83
86
|
},
|
|
84
87
|
"./prettier-common": {
|
|
85
88
|
"types": "./index.d.ts",
|
|
86
|
-
"import": "./
|
|
87
|
-
"default": "./
|
|
89
|
+
"import": "./src/prettier/prettier.config.common.js",
|
|
90
|
+
"default": "./src/prettier/prettier.config.common.js"
|
|
88
91
|
},
|
|
89
92
|
"./prettier-svelte": {
|
|
90
93
|
"types": "./index.d.ts",
|
|
91
|
-
"import": "./
|
|
92
|
-
"default": "./
|
|
94
|
+
"import": "./src/prettier/prettier-svelte.config.js",
|
|
95
|
+
"default": "./src/prettier/prettier-svelte.config.js"
|
|
93
96
|
},
|
|
94
97
|
"./stylelint-scss": {
|
|
95
98
|
"types": "./index.d.ts",
|
|
96
|
-
"import": "./
|
|
97
|
-
"default": "./
|
|
98
|
-
},
|
|
99
|
-
"./biome": {
|
|
100
|
-
"types": "./index.d.ts",
|
|
101
|
-
"import": "./packages/biome/biome.json",
|
|
102
|
-
"default": "./packages/biome/biome.json"
|
|
103
|
-
},
|
|
104
|
-
"./biome-common": {
|
|
105
|
-
"types": "./index.d.ts",
|
|
106
|
-
"import": "./packages/biome/configs/biome.common.json",
|
|
107
|
-
"default": "./packages/biome/configs/biome.common.json"
|
|
108
|
-
},
|
|
109
|
-
"./biome-react": {
|
|
110
|
-
"types": "./index.d.ts",
|
|
111
|
-
"import": "./packages/biome/configs/biome.react.json",
|
|
112
|
-
"default": "./packages/biome/configs/biome.react.json"
|
|
113
|
-
},
|
|
114
|
-
"./biome-next": {
|
|
115
|
-
"types": "./index.d.ts",
|
|
116
|
-
"import": "./packages/biome/configs/biome.next.json",
|
|
117
|
-
"default": "./packages/biome/configs/biome.next.json"
|
|
118
|
-
},
|
|
119
|
-
"./biome-svelte": {
|
|
120
|
-
"types": "./index.d.ts",
|
|
121
|
-
"import": "./packages/biome/configs/biome.svelte.json",
|
|
122
|
-
"default": "./packages/biome/configs/biome.svelte.json"
|
|
99
|
+
"import": "./src/stylelint/stylelint.config.scss.js",
|
|
100
|
+
"default": "./src/stylelint/stylelint.config.scss.js"
|
|
123
101
|
}
|
|
124
102
|
},
|
|
125
103
|
"files": [
|
|
126
104
|
"index.d.ts",
|
|
127
|
-
"
|
|
128
|
-
"
|
|
129
|
-
"
|
|
130
|
-
"
|
|
131
|
-
"packages/biome/biome.json",
|
|
132
|
-
"packages/biome/configs",
|
|
133
|
-
"packages/biome/LICENSE",
|
|
134
|
-
"packages/biome/docs",
|
|
135
|
-
"scripts/README.md"
|
|
105
|
+
"src",
|
|
106
|
+
"scripts",
|
|
107
|
+
"data",
|
|
108
|
+
"docs"
|
|
136
109
|
],
|
|
137
110
|
"scripts": {
|
|
138
|
-
"lint": "
|
|
139
|
-
"lint:eslint": "
|
|
140
|
-
"lint:stylelint": "
|
|
141
|
-
"lint:prettier": "
|
|
142
|
-
"lint:
|
|
143
|
-
"lint:fix": "npm run lint:fix
|
|
144
|
-
"lint:fix:eslint": "npm run lint:fix --workspace=packages/eslint",
|
|
145
|
-
"lint:fix:biome": "npm run lint:fix --workspace=packages/biome",
|
|
111
|
+
"lint": "eslint . && stylelint \"src/**/*.{css,scss}\" --config ./src/stylelint/stylelint.config.scss.js --allow-empty-input && prettier --check .",
|
|
112
|
+
"lint:eslint": "eslint .",
|
|
113
|
+
"lint:stylelint": "stylelint \"src/**/*.{css,scss}\" --config ./src/stylelint/stylelint.config.scss.js --allow-empty-input",
|
|
114
|
+
"lint:prettier": "prettier --check .",
|
|
115
|
+
"lint:fix": "eslint . --fix && stylelint \"src/**/*.{css,scss}\" --config ./src/stylelint/stylelint.config.scss.js --fix --allow-empty-input && prettier --write .",
|
|
116
|
+
"lint:fix:eslint": "npm run lint:fix",
|
|
146
117
|
"changelog": "conventional-changelog -p conventionalcommits -i CHANGELOG.md -s",
|
|
147
118
|
"changelog:dry": "conventional-changelog -p conventionalcommits",
|
|
148
119
|
"publish:npm": "npm publish --access public",
|
|
149
|
-
"inventory": "
|
|
150
|
-
"config:init": "node ./
|
|
151
|
-
"config:reinit": "node ./
|
|
152
|
-
"config:create": "node ./
|
|
120
|
+
"inventory": "node ./scripts/inventory.mjs",
|
|
121
|
+
"config:init": "node ./scripts/linter-init.mjs init --common --dir ./examples/init-smoke",
|
|
122
|
+
"config:reinit": "node ./scripts/linter-init.mjs reinit --common --dir ./examples/init-smoke",
|
|
123
|
+
"config:create": "node ./scripts/linter-init.mjs create --common --dir ./examples/init-smoke",
|
|
124
|
+
"config:remove-current": "bash ./scripts/remove-current.sh"
|
|
153
125
|
},
|
|
154
|
-
"workspaces": [
|
|
155
|
-
"packages/eslint",
|
|
156
|
-
"packages/biome"
|
|
157
|
-
],
|
|
158
126
|
"peerDependencies": {
|
|
159
|
-
"@biomejs/biome": ">=2.4.0 <3.0.0",
|
|
160
127
|
"eslint": "^9.0.0 || ^10.0.0",
|
|
161
128
|
"next": "^16.0.0",
|
|
162
129
|
"prettier": "^3.0.0",
|
|
@@ -165,9 +132,6 @@
|
|
|
165
132
|
"svelte": "^4.0.0 || ^5.0.0"
|
|
166
133
|
},
|
|
167
134
|
"peerDependenciesMeta": {
|
|
168
|
-
"@biomejs/biome": {
|
|
169
|
-
"optional": true
|
|
170
|
-
},
|
|
171
135
|
"eslint": {
|
|
172
136
|
"optional": true
|
|
173
137
|
},
|
|
@@ -188,7 +152,6 @@
|
|
|
188
152
|
}
|
|
189
153
|
},
|
|
190
154
|
"devDependencies": {
|
|
191
|
-
"@biomejs/biome": "^2.4.11",
|
|
192
155
|
"@stylistic/eslint-plugin-migrate": "^4.4.1",
|
|
193
156
|
"conventional-changelog-cli": "^5.0.0",
|
|
194
157
|
"conventional-changelog-conventionalcommits": "^9.0.0"
|
package/scripts/README.md
CHANGED
|
@@ -1,38 +1,43 @@
|
|
|
1
1
|
# Consumer config helpers (monorepo root)
|
|
2
2
|
|
|
3
|
-
From this repository root, use the npm scripts in the root [`package.json`](../package.json). They run
|
|
3
|
+
From this repository root, use the npm scripts in the root [`package.json`](../package.json). They run **`node ./scripts/linter-init.mjs`** against **[`examples/init-smoke`](../examples/init-smoke)** so we never write consumer stubs into the **`@st1ggy/linter-config`** package root (the CLI blocks that).
|
|
4
4
|
|
|
5
|
-
| Script
|
|
6
|
-
|
|
|
7
|
-
| `npm run config:init`
|
|
8
|
-
| `npm run config:reinit` | `reinit` — overwrite those
|
|
9
|
-
| `npm run config:create` | same as `config:init`
|
|
5
|
+
| Script | Effect |
|
|
6
|
+
| ----------------------- | --------------------------------------------------------------------------------------- |
|
|
7
|
+
| `npm run config:init` | `init` — create missing `eslint.config.js`, `prettier.config.js`, `stylelint.config.js` |
|
|
8
|
+
| `npm run config:reinit` | `reinit` — overwrite those three files |
|
|
9
|
+
| `npm run config:create` | same as `config:init` |
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Each run installs **`@st1ggy/linter-config`** into `examples/init-smoke` when needed (unless you add **`--skip-install`** to the underlying command in `package.json`).
|
|
12
|
+
|
|
13
|
+
### Legacy config cleanup (optional)
|
|
14
|
+
|
|
15
|
+
**`reinit`** only overwrites `eslint.config.js`, `prettier.config.js`, and `stylelint.config.js`. It does **not** call [`remove-current.sh`](remove-current.sh): that script is **interactive** (prompts per file) and is meant for one-off migration when old filenames still sit next to the new wrappers. From the repo root: **`npm run config:remove-current`** (runs `bash ./scripts/remove-current.sh` in the current shell cwd — run from the directory you want to clean, or `cd` there first).
|
|
16
|
+
|
|
17
|
+
Direct CLI (paths from repo root — same entry as published **`@st1ggy/linter-config`**):
|
|
12
18
|
|
|
13
19
|
```bash
|
|
14
|
-
node
|
|
15
|
-
node
|
|
20
|
+
node ./scripts/linter-init.mjs init --react
|
|
21
|
+
node ./scripts/linter-init.mjs reinit --svelte --dir ./my-app
|
|
16
22
|
```
|
|
17
23
|
|
|
18
24
|
## Flags (published package)
|
|
19
25
|
|
|
20
|
-
The
|
|
26
|
+
The CLI is published under the name **`@st1ggy/linter-config`** (see [`package.json`](../package.json) `bin`). In another project **after** `npm i -D @st1ggy/linter-config`:
|
|
21
27
|
|
|
22
28
|
```bash
|
|
23
|
-
npx linter-config init --
|
|
24
|
-
npx linter-config init --
|
|
25
|
-
npm exec linter-config -- reinit --
|
|
29
|
+
npx @st1ggy/linter-config init --common
|
|
30
|
+
npx @st1ggy/linter-config init --next
|
|
31
|
+
npm exec @st1ggy/linter-config -- reinit --svelte
|
|
26
32
|
```
|
|
27
33
|
|
|
28
|
-
Without installing first:
|
|
34
|
+
**Without** installing first:
|
|
29
35
|
|
|
30
36
|
```bash
|
|
31
|
-
npx --yes
|
|
37
|
+
npx --yes @st1ggy/linter-config init --react
|
|
32
38
|
```
|
|
33
39
|
|
|
34
|
-
- **`--eslint`** — `eslint.config.js` + `prettier.config.js` + `stylelint.config.js` (one stack).
|
|
35
|
-
- **`--biome`** — `biome.json`.
|
|
36
40
|
- **Stack (optional, default common):** `--common` | `--react` | `--next` | `--svelte` (at most one).
|
|
41
|
+
- **`--skip-install`:** only write wrapper files; do not run npm/pnpm/yarn/bun.
|
|
37
42
|
|
|
38
|
-
Shell shortcuts in
|
|
43
|
+
Shell shortcuts in this folder (`init-common.sh`, etc.) call **`node …/linter-init.mjs`** (same script as the published **`@st1ggy/linter-config`** CLI) with the matching stack; pass **`--skip-install`** through when needed.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Runs the same entry as `npx @st1ggy/linter-config` (see scripts/linter-init.mjs): writes wrappers and,
|
|
3
|
+
# unless --skip-install is passed, ensures @st1ggy/linter-config is installed when package.json exists.
|
|
4
|
+
set -euo pipefail
|
|
5
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
6
|
+
exec node "${SCRIPT_DIR}/linter-init.mjs" init --common "$@"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
// Collects effective flat-config rule lists and Stylelint rules from this
|
|
2
|
-
// Run from repo root: `node
|
|
3
|
-
// Or set `LINTER_CONFIG_ROOT` to override the default (
|
|
1
|
+
// Collects effective flat-config rule lists and Stylelint rules from this repo.
|
|
2
|
+
// Run from repo root: `node scripts/inventory.mjs`
|
|
3
|
+
// Or set `LINTER_CONFIG_ROOT` to override the default (repository root).
|
|
4
4
|
|
|
5
5
|
import { spawnSync } from 'node:child_process'
|
|
6
6
|
import { mkdirSync, writeFileSync } from 'node:fs'
|
|
@@ -12,7 +12,7 @@ import { fileURLToPath } from 'node:url'
|
|
|
12
12
|
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
|
13
13
|
const LINTER_ROOT = process.env.LINTER_CONFIG_ROOT ?? path.resolve(__dirname, '..')
|
|
14
14
|
|
|
15
|
-
const SOURCE_LABEL = '@st1ggy/linter-config@
|
|
15
|
+
const SOURCE_LABEL = '@st1ggy/linter-config@6.3.0 (local tree)'
|
|
16
16
|
|
|
17
17
|
const flatConfigPresets = [
|
|
18
18
|
{
|
|
@@ -171,7 +171,7 @@ async function main() {
|
|
|
171
171
|
writeFileSync(outputPath, body, 'utf8')
|
|
172
172
|
|
|
173
173
|
process.stdout.write(
|
|
174
|
-
`Wrote
|
|
174
|
+
`Wrote data/linter-config-inventory.json (${SOURCE_LABEL}, flat presets: ${Object.keys(flatConfigs).length}, stylelint rules: ${stylelint.ruleCount})\n`,
|
|
175
175
|
)
|
|
176
176
|
}
|
|
177
177
|
|