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 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 applying either unscoped will misfire.** `no-side-effects-in-index` flags any top-level statement that isn't a bare re-export -- applied to an ordinary file with real `export function`/`export const`/`export interface` declarations, every one of them trips it (confirmed directly: 88 false-positive errors on a single real source file in a repo that tried this). Scope the `extends` block itself to just `src/index.ts` if you want `no-side-effects-in-index`'s coverage from `recommended`/`barrel`, or -- what every current consumer of this plugin actually does -- skip `recommended`/`barrel` and wire the four `exadev/*` rules individually, each with your own project's real `files`/`ignores`, exactly as shown in the first example above. That's not a workaround; it's the intended shape once a project's re-export-ban exceptions and barrel location are genuinely project-specific.
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 apply to this repo's own source: `no-non-barrel-reexport` is scoped to `src/**/*.ts` excluding `src/index.ts` (the barrel is where re-exports are meant to live), and `no-side-effects-in-index` is scoped to `src/index.ts` alone -- 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
+ `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-DZKXx2me.cjs");
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-PQMeiTvg.js";
1
+ import { t as plugin } from "./plugin-Bx8s9ONl.js";
2
2
  export { plugin as default };
@@ -3,7 +3,7 @@
3
3
  const plugin = {
4
4
  meta: {
5
5
  name: "@exadev/eslint-config",
6
- version: "1.2.2",
6
+ version: "1.2.3",
7
7
  namespace: "exadev"
8
8
  },
9
9
  rules: {
@@ -7,7 +7,7 @@ import noSideEffectsInIndex from "./rules/no-side-effects-in-index.js";
7
7
  const plugin = {
8
8
  meta: {
9
9
  name: "@exadev/eslint-config",
10
- version: "1.2.2",
10
+ version: "1.2.3",
11
11
  namespace: "exadev"
12
12
  },
13
13
  rules: {
package/dist/plugin.cjs CHANGED
@@ -1,2 +1,2 @@
1
- const require_plugin = require("./plugin-DZKXx2me.cjs");
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-PQMeiTvg.js";
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-DZKXx2me.cjs");
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
@@ -1,4 +1,4 @@
1
- import { t as plugin } from "./plugin-PQMeiTvg.js";
1
+ import { t as plugin } from "./plugin-Bx8s9ONl.js";
2
2
  import tseslint from "typescript-eslint";
3
3
  //#region src/recommended-type-checked.ts
4
4
  const recommendedTypeChecked = [
@@ -26,6 +26,7 @@ const noNonBarrelReexport = {
26
26
  }
27
27
  },
28
28
  create(context) {
29
+ if (context.filename.endsWith("/src/index.ts")) return {};
29
30
  const importsByName = /* @__PURE__ */ new Map();
30
31
  const bareExportSpecifiers = [];
31
32
  const defaultExportDeclarations = [];
@@ -26,6 +26,7 @@ const noNonBarrelReexport = {
26
26
  }
27
27
  },
28
28
  create(context) {
29
+ if (context.filename.endsWith("/src/index.ts")) return {};
29
30
  const importsByName = /* @__PURE__ */ new Map();
30
31
  const bareExportSpecifiers = [];
31
32
  const defaultExportDeclarations = [];
@@ -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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "exadev-eslint-config",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "description": "Shared custom ESLint rules and plugin for ExaDev projects",
5
5
  "type": "module",
6
6
  "sideEffects": false,