@webadeva/eslint-config 0.1.1 → 0.1.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/dist/index.cjs CHANGED
@@ -205,9 +205,23 @@ const getProjectFiles = (configPath, seen = /* @__PURE__ */ new Set()) => {
205
205
  projectFilesCache.set(configPath, files);
206
206
  return files;
207
207
  };
208
+ let projectFilesReadAt = Date.now();
209
+ const changedSinceFilesRead = (filePath) => {
210
+ try {
211
+ return (0, node_fs.statSync)(filePath).ctimeMs >= projectFilesReadAt;
212
+ } catch {
213
+ return false;
214
+ }
215
+ };
208
216
  const isInProject = (filePath) => {
209
217
  const configPath = findNearestConfig((0, node_path.dirname)(filePath));
210
- return configPath !== void 0 && getProjectFiles(configPath).has((0, node_path.resolve)(filePath));
218
+ if (configPath === void 0) return false;
219
+ const path = (0, node_path.resolve)(filePath);
220
+ if (getProjectFiles(configPath).has(path)) return true;
221
+ if (!changedSinceFilesRead(path)) return false;
222
+ projectFilesCache.clear();
223
+ projectFilesReadAt = Date.now();
224
+ return getProjectFiles(configPath).has(path);
211
225
  };
212
226
  /** The tsconfig typescript-eslint uses for files outside every project. */
213
227
  const defaultProjectConfig = packageRequire.resolve("@webadeva/eslint-config/tsconfig.default.json");
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { n as baseConfigs, t as untypedFilesConfigs } from "./untyped-Wrh4hLMj.mjs";
1
+ import { n as baseConfigs, t as untypedFilesConfigs } from "./untyped-BaVe3nYe.mjs";
2
2
  //#region src/index.ts
3
3
  const config = [...baseConfigs, ...untypedFilesConfigs()];
4
4
  //#endregion
package/dist/next.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { n as baseConfigs, t as untypedFilesConfigs } from "./untyped-Wrh4hLMj.mjs";
2
- import { n as reactDisableTypeChecked, t as reactConfigs } from "./react-C-VV0l5P.mjs";
1
+ import { n as baseConfigs, t as untypedFilesConfigs } from "./untyped-BaVe3nYe.mjs";
2
+ import { n as reactDisableTypeChecked, t as reactConfigs } from "./react-Dq8MXjy6.mjs";
3
3
  import { t as nextConfigs } from "./next-CWjuCwpN.mjs";
4
4
  //#region src/next.ts
5
5
  const config = [
@@ -1,4 +1,4 @@
1
- import { r as ensureTypeScript } from "./untyped-Wrh4hLMj.mjs";
1
+ import { r as ensureTypeScript } from "./untyped-BaVe3nYe.mjs";
2
2
  import { createRequire } from "node:module";
3
3
  import { readFileSync, readdirSync } from "node:fs";
4
4
  import { join } from "node:path";
package/dist/react.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { n as baseConfigs, t as untypedFilesConfigs } from "./untyped-Wrh4hLMj.mjs";
2
- import { n as reactDisableTypeChecked, t as reactConfigs } from "./react-C-VV0l5P.mjs";
1
+ import { n as baseConfigs, t as untypedFilesConfigs } from "./untyped-BaVe3nYe.mjs";
2
+ import { n as reactDisableTypeChecked, t as reactConfigs } from "./react-Dq8MXjy6.mjs";
3
3
  //#region src/react.ts
4
4
  const config = [
5
5
  ...baseConfigs,
@@ -1,5 +1,5 @@
1
- import { n as baseConfigs, t as untypedFilesConfigs } from "./untyped-Wrh4hLMj.mjs";
2
- import { n as reactDisableTypeChecked, t as reactConfigs } from "./react-C-VV0l5P.mjs";
1
+ import { n as baseConfigs, t as untypedFilesConfigs } from "./untyped-BaVe3nYe.mjs";
2
+ import { n as reactDisableTypeChecked, t as reactConfigs } from "./react-Dq8MXjy6.mjs";
3
3
  import { t as nextConfigs } from "./next-CWjuCwpN.mjs";
4
4
  import storybook from "eslint-plugin-storybook";
5
5
  //#region src/configs/storybook.ts
@@ -5,7 +5,7 @@ import importPlugin from "eslint-plugin-import";
5
5
  import preferArrowFunctions from "eslint-plugin-prefer-arrow-functions";
6
6
  import prettier from "eslint-plugin-prettier";
7
7
  import globals from "globals";
8
- import { existsSync, readdirSync } from "node:fs";
8
+ import { existsSync, readdirSync, statSync } from "node:fs";
9
9
  import { dirname, join, resolve } from "node:path";
10
10
  //#region src/plugin/rules/max-lines.ts
11
11
  const DEFAULTS = {
@@ -177,9 +177,23 @@ const getProjectFiles = (configPath, seen = /* @__PURE__ */ new Set()) => {
177
177
  projectFilesCache.set(configPath, files);
178
178
  return files;
179
179
  };
180
+ let projectFilesReadAt = Date.now();
181
+ const changedSinceFilesRead = (filePath) => {
182
+ try {
183
+ return statSync(filePath).ctimeMs >= projectFilesReadAt;
184
+ } catch {
185
+ return false;
186
+ }
187
+ };
180
188
  const isInProject = (filePath) => {
181
189
  const configPath = findNearestConfig(dirname(filePath));
182
- return configPath !== void 0 && getProjectFiles(configPath).has(resolve(filePath));
190
+ if (configPath === void 0) return false;
191
+ const path = resolve(filePath);
192
+ if (getProjectFiles(configPath).has(path)) return true;
193
+ if (!changedSinceFilesRead(path)) return false;
194
+ projectFilesCache.clear();
195
+ projectFilesReadAt = Date.now();
196
+ return getProjectFiles(configPath).has(path);
183
197
  };
184
198
  /** The tsconfig typescript-eslint uses for files outside every project. */
185
199
  const defaultProjectConfig = packageRequire.resolve("@webadeva/eslint-config/tsconfig.default.json");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webadeva/eslint-config",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Shared ESLint flat configs for TypeScript projects: type-aware rules, Prettier, and presets for React, Next.js, and Storybook.",
5
5
  "keywords": [
6
6
  "eslint",