exadev-eslint-config 1.2.2 → 1.2.3
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 +4 -3
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{plugin-DZKXx2me.cjs → plugin-BSeiZs_j.cjs} +1 -1
- package/dist/{plugin-PQMeiTvg.js → plugin-Bx8s9ONl.js} +1 -1
- package/dist/plugin.cjs +1 -1
- package/dist/plugin.js +1 -1
- package/dist/recommended-type-checked.cjs +1 -1
- package/dist/recommended-type-checked.js +1 -1
- package/dist/rules/no-non-barrel-reexport.cjs +1 -0
- package/dist/rules/no-non-barrel-reexport.js +1 -0
- package/dist/rules/no-side-effects-in-index.cjs +1 -0
- package/dist/rules/no-side-effects-in-index.js +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -68,8 +68,9 @@ export default tseslint.config(
|
|
|
68
68
|
);
|
|
69
69
|
```
|
|
70
70
|
|
|
71
|
-
**`recommended`/`barrel` carry no `files`/`ignores` of their own, and
|
|
72
|
-
|
|
71
|
+
**`recommended`/`barrel` carry no `files`/`ignores` of their own, and are safe to apply unscoped anyway -- the two rules that care which file they're looking at (`no-side-effects-in-index`, `no-non-barrel-reexport`) each check `context.filename` themselves, the same self-scoping pattern `no-non-barrel-index` already used.** `no-side-effects-in-index` no-ops on every file except `src/index.ts`, since it has no legitimate target anywhere else; `no-non-barrel-reexport` no-ops specifically on `src/index.ts`, since a real single-statement re-export there is the intended, normal shape. An earlier version of this package lacked that self-scoping and genuinely misfired when `recommended`/`barrel` were applied without an external `files: ['src/index.ts']`/`ignores: ['src/index.ts']` wrapper -- 88 false-positive errors on a single real source file in a repo that tried it, since `no-side-effects-in-index` flagged every ordinary `export function`/`export const`/`export interface` declaration it saw. That's fixed at the rule level now, not documented around.
|
|
72
|
+
|
|
73
|
+
The one thing self-scoping can't know on your behalf is a barrel that lives somewhere other than `src/index.ts`, or a project-specific exception beyond the barrel (an extra file you want exempt from the re-export ban). For either of those, layer an additional override on top of `recommended`/`barrel` -- e.g. `{ files: ['lib/other-legacy-reexport.ts'], rules: { 'exadev/no-non-barrel-reexport': 'off' } }` -- rather than falling back to wiring all four rules individually, which is still fine but no longer required for the common case.
|
|
73
74
|
|
|
74
75
|
Both `recommended` and `barrel` are usable in a plain JavaScript project with no TypeScript and no `typescript-eslint` installed: this plugin's own four rules operate on plain ESTree import/export/declaration nodes, nothing TypeScript-specific, and neither config references `typescript-eslint` at all.
|
|
75
76
|
|
|
@@ -136,7 +137,7 @@ The `lint`/`typecheck`/`test`/`build` npm scripts are thin wrappers around turbo
|
|
|
136
137
|
|
|
137
138
|
## Conventions
|
|
138
139
|
|
|
139
|
-
`eslint.config.ts` dogfoods this package's own rules on itself, importing `./src/index` by relative path rather than as an installed dependency. All four rules
|
|
140
|
+
`eslint.config.ts` dogfoods this package's own rules on itself, importing `./src/index` by relative path rather than as an installed dependency. All four rules are wired in one block with no `files`/`ignores` of its own -- `no-side-effects-in-index` and `no-non-barrel-reexport` each self-scope to `src/index.ts` internally, so applying them repo-wide here is both the simplest wiring and the live proof that doing so works. The plugin-construction logic lives in `src/plugin.ts` specifically so `src/index.ts` can stay a pure re-export point both rules assume.
|
|
140
141
|
|
|
141
142
|
`tsconfig.json` enables `verbatimModuleSyntax` (type-only imports/exports must use `import type`/`export type` explicitly -- enforced too by the `consistent-type-imports` eslint rule) and `noUncheckedIndexedAccess` (indexed access returns `T | undefined`, narrow before use rather than asserting).
|
|
142
143
|
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const require_plugin = require("./plugin-
|
|
1
|
+
const require_plugin = require("./plugin-BSeiZs_j.cjs");
|
|
2
2
|
module.exports = require_plugin.plugin;
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as plugin } from "./plugin-
|
|
1
|
+
import { t as plugin } from "./plugin-Bx8s9ONl.js";
|
|
2
2
|
export { plugin as default };
|
package/dist/plugin.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const require_plugin = require("./plugin-
|
|
1
|
+
const require_plugin = require("./plugin-BSeiZs_j.cjs");
|
|
2
2
|
module.exports = require_plugin.plugin;
|
package/dist/plugin.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as plugin } from "./plugin-
|
|
1
|
+
import { t as plugin } from "./plugin-Bx8s9ONl.js";
|
|
2
2
|
export { plugin as default };
|
|
@@ -20,7 +20,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
20
20
|
enumerable: true
|
|
21
21
|
}) : target, mod));
|
|
22
22
|
//#endregion
|
|
23
|
-
const require_plugin = require("./plugin-
|
|
23
|
+
const require_plugin = require("./plugin-BSeiZs_j.cjs");
|
|
24
24
|
let typescript_eslint = require("typescript-eslint");
|
|
25
25
|
typescript_eslint = __toESM(typescript_eslint, 1);
|
|
26
26
|
//#region src/recommended-type-checked.ts
|
|
@@ -10,6 +10,7 @@ const noSideEffectsInIndex = {
|
|
|
10
10
|
messages: { notAPureReexport: "The public barrel (src/index.ts) may contain only re-export statements ('export * from ...' / 'export { x } from ...' / 'export type { x } from ...') -- nothing else, so it can never have a side effect at import time by construction. Found: {{ description }}." }
|
|
11
11
|
},
|
|
12
12
|
create(context) {
|
|
13
|
+
if (!context.filename.endsWith("/src/index.ts")) return {};
|
|
13
14
|
return { Program(node) {
|
|
14
15
|
for (const statement of node.body) if (!isPureReexport(statement)) context.report({
|
|
15
16
|
node: statement,
|
|
@@ -10,6 +10,7 @@ const noSideEffectsInIndex = {
|
|
|
10
10
|
messages: { notAPureReexport: "The public barrel (src/index.ts) may contain only re-export statements ('export * from ...' / 'export { x } from ...' / 'export type { x } from ...') -- nothing else, so it can never have a side effect at import time by construction. Found: {{ description }}." }
|
|
11
11
|
},
|
|
12
12
|
create(context) {
|
|
13
|
+
if (!context.filename.endsWith("/src/index.ts")) return {};
|
|
13
14
|
return { Program(node) {
|
|
14
15
|
for (const statement of node.body) if (!isPureReexport(statement)) context.report({
|
|
15
16
|
node: statement,
|