exadev-eslint-config 2.31.1 → 2.31.2
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 +29 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -1215,6 +1215,35 @@ export default exadevConfig({
|
|
|
1215
1215
|
});
|
|
1216
1216
|
```
|
|
1217
1217
|
|
|
1218
|
+
### Reading the shared layout from @exadev/config
|
|
1219
|
+
|
|
1220
|
+
A repository that describes its workspace once in [`@exadev/config`](https://github.com/ExaDev/config)'s `layout` section can feed the same description to these rules. The `layout` section's type is checked equal to `WorkspaceArchitectureOptions`, so the value `loadSection(layoutSection)` returns is passed to `workspaceArchitecture` as it is. In an ESM `eslint.config.ts`, read it with top-level `await`:
|
|
1221
|
+
|
|
1222
|
+
```ts
|
|
1223
|
+
// eslint.config.ts
|
|
1224
|
+
import { layoutSection, loadSection } from '@exadev/config';
|
|
1225
|
+
import { exadevConfig } from '@exadev/eslint-config';
|
|
1226
|
+
import { defineConfig } from 'eslint/config';
|
|
1227
|
+
|
|
1228
|
+
const layout = await loadSection(layoutSection, { cwd: import.meta.dirname });
|
|
1229
|
+
if (layout === undefined) throw new Error('exadev.config.ts defines no layout section');
|
|
1230
|
+
|
|
1231
|
+
export default defineConfig(
|
|
1232
|
+
{
|
|
1233
|
+
languageOptions: {
|
|
1234
|
+
parserOptions: { project: './tsconfig.json', tsconfigRootDir: import.meta.dirname },
|
|
1235
|
+
},
|
|
1236
|
+
},
|
|
1237
|
+
...exadevConfig({ workspaceArchitecture: layout }),
|
|
1238
|
+
);
|
|
1239
|
+
```
|
|
1240
|
+
|
|
1241
|
+
`loadSection` resolves to `undefined` when no `layout` section is defined, hence the check. `cwd` is the directory holding `exadev.config.ts` (or `exadev.layout.config.ts`). A layout that fails the section's schema throws when the config loads, with the path and the rule that failed.
|
|
1242
|
+
|
|
1243
|
+
The layout carries structure only: groups, ranks, slices, naming and isolated pairs. Policy stays here, so `allow`, `exemptTargetGroups`, `requiredFiles`, `devOnly` and `requiredScripts` are not part of it; add them with a spread (`workspaceArchitecture: { ...layout, allow: [...] }`).
|
|
1244
|
+
|
|
1245
|
+
The ESLint config itself stays in `eslint.config.*`. Only the layout moves into `exadev.config.ts`: ESLint loads its own config file, and the unified file has no section for rules or plugins. Neither package depends on the other: install `@exadev/config` (and its `cosmiconfig` peer) in the repository, and `@exadev/eslint-config` takes the value structurally. This repository keeps `@exadev/config` as a dev dependency only, for the test that fails when either side's types drift apart.
|
|
1246
|
+
|
|
1218
1247
|
## Turbo
|
|
1219
1248
|
|
|
1220
1249
|
These rules keep a repository that uses [turbo](https://turborepo.dev) honest about what turbo actually runs. Turbo skips a task silently when no package has a script of that name, restores only a task's log when `outputs` is missing, and caches a task under a hash taken before the task runs; none of that shows up as an error. They share one options object, `TurboOptions`, and all are off unless the `turbo` option is given, since only a repository can say it uses turbo. Enable them through `exadevConfig({ turbo })` or the standalone `turboConfig(options)`, which returns the blocks to spread into `defineConfig(...)`:
|
package/dist/index.cjs
CHANGED
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "exadev-eslint-config",
|
|
3
3
|
"description": "Shared custom ESLint rules and plugin for ExaDev projects",
|
|
4
|
-
"version": "2.31.
|
|
4
|
+
"version": "2.31.2",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@eslint/js": "^10.0.1",
|
|
7
7
|
"@microsoft/tsdoc": "0.17.0",
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"@eslint/config-helpers": "0.7.0",
|
|
21
21
|
"@eslint/json": "2.1.0",
|
|
22
22
|
"@eslint/markdown": "8.0.3",
|
|
23
|
+
"@exadev/config": "1.1.3",
|
|
23
24
|
"@humanwhocodes/momoa": "^3.3.13",
|
|
24
25
|
"@next/eslint-plugin-next": "^16.3.2",
|
|
25
26
|
"@semantic-release/changelog": "^7.0.0",
|
|
@@ -32,6 +33,7 @@
|
|
|
32
33
|
"@typescript-eslint/rule-tester": "^8.67.0",
|
|
33
34
|
"@vitest/coverage-v8": "^4.1.10",
|
|
34
35
|
"@vitest/eslint-plugin": "^1.6.27",
|
|
36
|
+
"cosmiconfig": "10.0.1",
|
|
35
37
|
"eslint": "^10.8.0",
|
|
36
38
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
37
39
|
"eslint-plugin-react": "^7.37.5",
|