@fullstacksjs/eslint-config 11.1.3 → 11.1.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fullstacksjs/eslint-config",
3
- "version": "11.1.3",
3
+ "version": "11.1.5",
4
4
  "license": "MIT",
5
5
  "author": "fullstacks <fullstacksjs@gmail.com>",
6
6
  "description": "fullstacks eslint config",
package/src/index.js CHANGED
@@ -2,7 +2,6 @@ const merge = require('deepmerge');
2
2
  const { isPackageExists } = require('local-pkg');
3
3
  const base = require('./modules/base');
4
4
  const cypress = require('./modules/cypress');
5
- const ignores = require('./modules/ignores');
6
5
  const imports = require('./modules/imports');
7
6
  const prettier = require('./modules/prettier');
8
7
  const tailwind = require('./modules/tailwind');
@@ -18,6 +17,7 @@ const react = require('./modules/react');
18
17
  const storybook = require('./modules/storybook');
19
18
  const typescript = require('./modules/typescript');
20
19
  const playwright = require('./modules/playwright');
20
+ const compose = require('./utils/compose');
21
21
 
22
22
  const testPackages = ['jest', 'vitest', 'cypress', 'playwright'];
23
23
 
@@ -42,6 +42,7 @@ const defaultOptions = {
42
42
  typescript: isPackageExists('typescript') ? { projects: true } : false,
43
43
  unocss: isPackageExists('unocss'),
44
44
  playwright: isPackageExists('playwright'),
45
+ ignores: [],
45
46
  };
46
47
 
47
48
  /**
@@ -60,28 +61,28 @@ function init(initOptions, ...extend) {
60
61
  options.import = {};
61
62
  }
62
63
 
63
- const rules = [ignores(), base()];
64
+ const rules = [compose(base, options)];
64
65
 
65
- if (options.fp) rules.push(fp(options));
66
- if (options.import) rules.push(imports(options));
67
- if (options.tailwind) rules.push(tailwind(options));
68
- if (options.test) rules.push(tests(options));
69
- if (options.node) rules.push(node(options));
70
- if (options.jest) rules.push(jest(options));
71
- if (options.vitest) rules.push(vitest(options));
72
- if (options.cypress) rules.push(cypress(options));
73
- if (options.react) rules.push(react(options));
74
- if (options.storybook) rules.push(storybook(options));
75
- if (options.typescript) rules.push(typescript(options));
76
- if (options.playwright) rules.push(playwright(options));
66
+ if (options.fp) rules.push(compose(fp, options));
67
+ if (options.import) rules.push(compose(imports, options));
68
+ if (options.tailwind) rules.push(compose(tailwind, options));
69
+ if (options.test) rules.push(compose(tests, options));
70
+ if (options.node) rules.push(compose(node, options));
71
+ if (options.jest) rules.push(compose(jest, options));
72
+ if (options.vitest) rules.push(compose(vitest, options));
73
+ if (options.cypress) rules.push(compose(cypress, options));
74
+ if (options.react) rules.push(compose(react, options));
75
+ if (options.storybook) rules.push(compose(storybook, options));
76
+ if (options.typescript) rules.push(compose(typescript, options));
77
+ if (options.playwright) rules.push(compose(playwright, options));
77
78
 
78
79
  // ISSUE: Waiting for FlatConfig support https://github.com/dimaMachina/graphql-eslint/issues/2178
79
- // if (false && options.graphql) rules.push(graphql(options));
80
+ // if (false && options.graphql) rules.push(compose(graphql,options));
80
81
  // ISSUE: Waiting for FlatConfig support https://github.com/vercel/next/issues/64409#issuecomment-2057325722
81
- // if (false && options.next) rules.push(next(options));
82
+ // if (false && options.next) rules.push(compose(next,options));
82
83
 
83
- if (options.strict) rules.push(strict(options));
84
- if (options.prettier) rules.push(prettier(options));
84
+ if (options.strict) rules.push(compose(strict, options));
85
+ if (options.prettier) rules.push(compose(prettier, options));
85
86
 
86
87
  return rules.concat(extend);
87
88
  }
package/src/init.d.ts CHANGED
@@ -17,6 +17,7 @@ export interface Options {
17
17
  playwright?: boolean;
18
18
  typescript?: { projects: string[] | string | boolean; tsconfigRootDir?: string };
19
19
  disableExpensiveRules?: boolean;
20
+ ignores?: string[];
20
21
  }
21
22
 
22
23
  export declare const init: (opts: Options) => import('eslint').Linter.FlatConfig[];
@@ -0,0 +1,14 @@
1
+ const { ignoreGlobs } = require('./globs');
2
+
3
+ /**
4
+ * @param { (options: import('eslint').Linter.FlatConfig) => import('eslint').Linter.FlatConfig } module
5
+ * @param { import('../init').Options } options
6
+ * @return { import('eslint').Linter.FlatConfig }
7
+ */
8
+ function compose(module, options) {
9
+ const config = module(options);
10
+ config.ignores = [config.ignores, ...options.ignores, ...ignoreGlobs];
11
+ return config;
12
+ }
13
+
14
+ module.exports = compose;
@@ -35,6 +35,38 @@ const globs = {
35
35
  };
36
36
 
37
37
  const allSrc = [globs.src, globs.style, globs.allJson, globs.md, globs.svelte, globs.vue, globs.yaml, globs.xml, globs.html];
38
+ const ignoreGlobs = [
39
+ '**/node_modules',
40
+ '**/dist',
41
+ '**/package-lock.json',
42
+ '**/yarn.lock',
43
+ '**/pnpm-lock.yaml',
44
+ '**/bun.lockb',
45
+
46
+ '**/output',
47
+ '**/coverage',
48
+ '**/temp',
49
+ '**/.temp',
50
+ '**/tmp',
51
+ '**/.tmp',
52
+ '**/.nx',
53
+ '**/.history',
54
+ '**/.vitepress/cache',
55
+ '**/.nuxt',
56
+ '**/.next',
57
+ '**/.vercel',
58
+ '**/.changeset',
59
+ '**/.idea',
60
+ '**/.cache',
61
+ '**/.output',
62
+ '**/.vite-inspect',
63
+ '**/.yarn',
64
+ '**/LICENSE*',
65
+ '**/*.min.*',
66
+
67
+ '**/__snapshots__',
68
+ ];
38
69
 
39
70
  module.exports.globs = globs;
40
71
  module.exports.allSrc = allSrc;
72
+ module.exports.ignoreGlobs = ignoreGlobs;
@@ -1,39 +0,0 @@
1
- /** @return { import('eslint').Linter.FlatConfig } */
2
- function ignores() {
3
- return {
4
- name: 'fullstacksjs/ignores',
5
- ignores: [
6
- '**/node_modules',
7
- '**/dist',
8
- '**/package-lock.json',
9
- '**/yarn.lock',
10
- '**/pnpm-lock.yaml',
11
- '**/bun.lockb',
12
-
13
- '**/output',
14
- '**/coverage',
15
- '**/temp',
16
- '**/.temp',
17
- '**/tmp',
18
- '**/.tmp',
19
- '**/.nx',
20
- '**/.history',
21
- '**/.vitepress/cache',
22
- '**/.nuxt',
23
- '**/.next',
24
- '**/.vercel',
25
- '**/.changeset',
26
- '**/.idea',
27
- '**/.cache',
28
- '**/.output',
29
- '**/.vite-inspect',
30
- '**/.yarn',
31
- '**/LICENSE*',
32
- '**/*.min.*',
33
-
34
- '**/__snapshots__',
35
- ],
36
- };
37
- }
38
-
39
- module.exports = ignores;