@fullstacksjs/eslint-config 14.8.1 → 15.0.0

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.
Files changed (55) hide show
  1. package/README.md +1 -20
  2. package/dist/index.mjs +1894 -0
  3. package/package.json +44 -46
  4. package/src/index.mjs +5 -5
  5. package/src/modules/base.mjs +10 -2
  6. package/src/modules/cypress.mjs +1 -0
  7. package/src/modules/imports.mjs +1 -0
  8. package/src/modules/jest.mjs +1 -0
  9. package/src/modules/next.mjs +1 -0
  10. package/src/modules/node.mjs +3 -0
  11. package/src/modules/perfectionist.mjs +1 -0
  12. package/src/modules/playwright.mjs +1 -0
  13. package/src/modules/prettier.mjs +1 -0
  14. package/src/modules/promise.mjs +1 -0
  15. package/src/modules/react.mjs +2 -0
  16. package/src/modules/regex.mjs +1 -0
  17. package/src/modules/storybook.mjs +1 -0
  18. package/src/modules/stylistic.mjs +1 -0
  19. package/src/modules/tailwind.mjs +1 -0
  20. package/src/modules/tests.mjs +4 -1
  21. package/src/modules/typescript.mjs +22 -4
  22. package/src/modules/vitest.mjs +1 -0
  23. package/src/utils/nextAllowExportNames.mjs +7 -0
  24. package/cjs/index.js +0 -137
  25. package/cjs/modules/base.js +0 -235
  26. package/cjs/modules/cypress.js +0 -39
  27. package/cjs/modules/ignore.js +0 -26
  28. package/cjs/modules/imports.js +0 -124
  29. package/cjs/modules/jest.js +0 -102
  30. package/cjs/modules/next.js +0 -48
  31. package/cjs/modules/node.js +0 -76
  32. package/cjs/modules/perfectionist.js +0 -54
  33. package/cjs/modules/playwright.js +0 -89
  34. package/cjs/modules/prettier.js +0 -97
  35. package/cjs/modules/promise.js +0 -45
  36. package/cjs/modules/react.js +0 -190
  37. package/cjs/modules/regex.js +0 -122
  38. package/cjs/modules/storybook.js +0 -49
  39. package/cjs/modules/stylistic.js +0 -94
  40. package/cjs/modules/tailwind.js +0 -56
  41. package/cjs/modules/tests.js +0 -52
  42. package/cjs/modules/typescript.js +0 -277
  43. package/cjs/modules/vitest.js +0 -116
  44. package/cjs/types/index.d.ts +0 -143
  45. package/cjs/types/modules/import.d.ts +0 -7
  46. package/cjs/types/modules/react.d.ts +0 -10
  47. package/cjs/types/modules/regex.d.ts +0 -5
  48. package/cjs/types/modules/tailwind.d.ts +0 -13
  49. package/cjs/types/modules/typescript.d.ts +0 -38
  50. package/cjs/utils/conditions.js +0 -25
  51. package/cjs/utils/getGitignorePatterns.js +0 -35
  52. package/cjs/utils/globs.js +0 -37
  53. package/cjs/utils/naming-convention.js +0 -63
  54. package/cjs/utils/nextAllowExportNames.js +0 -7
  55. package/cjs/utils/objectOrEmpty.js +0 -14
@@ -1,143 +0,0 @@
1
- import type { Linter } from 'eslint';
2
- import type { ConfigWithExtends } from 'eslint-flat-config-utils';
3
-
4
- import type { ImportOptions } from './modules/import';
5
- import type { ReactOptions } from './modules/react';
6
- import type { RegexOptions } from './modules/regex';
7
- import type { TailwindOptions } from './modules/tailwind';
8
- import type { TypeScriptOptions } from './modules/typescript';
9
-
10
- interface ConfigWithOverrides {
11
- /**
12
- * Override the configuration.
13
- *
14
- * The properties of this object are merged with and take precedence over the default configuration.
15
- *
16
- * There is no guarantee that the resulting configuration works correctly — it depends on the options you provide.
17
- *
18
- * @see [eslint-flat-config-utils: `mergeConfigs`](https://jsr.io/@antfu/eslint-flat-config-utils/doc/~/mergeConfigs)
19
- */
20
- overrides?: ConfigWithExtends;
21
- }
22
-
23
- export interface Options extends Linter.Config {
24
- /**
25
- * Controls Base.
26
- * @default true
27
- */
28
- base?: boolean | ConfigWithOverrides;
29
- /**
30
- * Controls React plugin.
31
- * @default true - If you have `react` or `react-dom` in your dependencies.
32
- */
33
- react?: boolean | ReactOptions;
34
- /**
35
- * Controls [Perfectionist plugin](https://www.npmjs.com/package/eslint-plugin-perfectionist).
36
- * @default true
37
- */
38
- sort?: boolean | ConfigWithOverrides;
39
- /**
40
- * Controls Next plugin.
41
- * @default true - If you have `next` in your dependencies.
42
- */
43
- next?: boolean | ConfigWithOverrides;
44
- /**
45
- * Controls Tailwind plugin.
46
- * @default false
47
- * @see https://github.com/schoero/eslint-plugin-better-tailwindcss/blob/main/docs/settings/settings.md
48
- */
49
- tailwind?: false | TailwindOptions;
50
- /**
51
- * Controls [Node plugin](https://www.npmjs.com/package/eslint-plugin-n).
52
- * @default false
53
- */
54
- node?: boolean | ConfigWithOverrides;
55
- /**
56
- * Enables all strict rules.
57
- * @default false
58
- */
59
- strict?: boolean;
60
- /**
61
- * Controls [import plugin](https://www.npmjs.com/package/eslint-plugin-import-x).
62
- * @default true
63
- */
64
- import?: boolean | ImportOptions;
65
- /**
66
- * @default true - If you have `type: module` in your `package.json`.
67
- */
68
- esm?: boolean;
69
- /**
70
- * Controls [test plugin](https://www.npmjs.com/package/eslint-plugin-jest-formatting).
71
- * @default true - If you have one of `jest`, `vitest`, `cypress`, `@playwright/test` in your dependencies.
72
- */
73
- test?: boolean | ConfigWithOverrides;
74
- /**
75
- * Controls [Jest plugin](https://www.npmjs.com/package/eslint-plugin-jest).
76
- * @default true - If you have `jest` in your dependencies.
77
- */
78
- jest?: boolean | ConfigWithOverrides;
79
- /**
80
- * Controls [Vitest plugin](https://www.npmjs.com/package/eslint-plugin-vitest).
81
- * @default true - If you have `vitest` in your dependencies.
82
- */
83
- vitest?: boolean | ConfigWithOverrides;
84
- /**
85
- * Controls [Cypress plugin](https://www.npmjs.com/package/eslint-plugin-cypress).
86
- * @default true - If you have `cypress` in your dependencies.
87
- */
88
- cypress?: boolean | ConfigWithOverrides;
89
- /**
90
- * Controls [Storybook plugin](https://www.npmjs.com/package/eslint-plugin-storybook).
91
- * @default true if you have `storybook` in your dependencies.
92
- */
93
- storybook?: boolean | ConfigWithOverrides;
94
- /**
95
- * Controls [Prettier plugin](https://www.npmjs.com/package/eslint-plugin-prettier).
96
- * @default true - If you have `prettier` in your dependencies.
97
- */
98
- prettier?: boolean | ConfigWithOverrides;
99
- /**
100
- * Controls [Playwright plugin](https://www.npmjs.com/package/eslint-plugin-playwright).
101
- * @default true - If you have `@playwright/test` in your dependencies.
102
- */
103
- playwright?: boolean | ConfigWithOverrides;
104
- /**
105
- * Controls [Promise plugin](https://www.npmjs.com/package/eslint-plugin-promise).
106
- * @default true
107
- */
108
- promise?: boolean | ConfigWithOverrides;
109
- /**
110
- * Controls [Stylistic plugin](https://www.npmjs.com/package/@stylistic/eslint-plugin).
111
- * @default true
112
- */
113
- stylistic?: boolean | ConfigWithOverrides;
114
- /**
115
- * Controls [TypeScript plugin](https://www.npmjs.com/package/typescript-eslint).
116
- * @default true - If you have `typescript` in your dependencies.
117
- */
118
- typescript?: boolean | TypeScriptOptions;
119
- /**
120
- * Controls [Regex plugin](https://www.npmjs.com/package/eslint-plugin-regexp).
121
- * @default { allowedCharacterRanges: ['all'] }
122
- */
123
- regex?: boolean | RegexOptions;
124
- /**
125
- * Disables expensive rules.
126
- * @default false
127
- */
128
- disableExpensiveRules?: boolean;
129
- /**
130
- * List of globs to ignore
131
- * @default []
132
- */
133
- ignores?: string[];
134
- /**
135
- * .gitignore file path relative to ESLint configuration file. Set to `false` to disable.
136
- * @default './.gitignore'
137
- */
138
- gitignore?: string | false;
139
- }
140
-
141
- export declare function defineConfig(initOptions?: Options, ...extend: Linter.Config[]): Linter.Config[];
142
-
143
- export declare const init: typeof defineConfig;
@@ -1,7 +0,0 @@
1
- import type { ConfigWithOverrides } from '..';
2
-
3
- interface ImportOptions extends ConfigWithOverrides {
4
- internalRegExp?: string;
5
- lifetime?: number;
6
- projects?: string | string[];
7
- }
@@ -1,10 +0,0 @@
1
- import type { ConfigWithOverrides } from '..';
2
-
3
- interface ReactOptions extends ConfigWithOverrides {
4
- version?: string;
5
- importSource?: string;
6
- compilationMode?: 'all' | 'annotation' | 'infer' | 'syntax'; // Use the same compilationMode as the React Compiler config for consistent analysis
7
- polymorphicPropName?: string;
8
- additionalStateHooks?: string;
9
- additionalEffectHooks?: string;
10
- }
@@ -1,5 +0,0 @@
1
- import type { ConfigWithOverrides } from '..';
2
-
3
- interface RegexOptions extends ConfigWithOverrides {
4
- allowedCharacterRanges?: string[];
5
- }
@@ -1,13 +0,0 @@
1
- import type { ConfigWithOverrides } from '..';
2
-
3
- interface TailwindOptionsWithEntryPoint extends ConfigWithOverrides {
4
- entryPoint: string;
5
- tailwindConfig?: string;
6
- }
7
-
8
- interface TailwindOptionsWithConfig extends ConfigWithOverrides {
9
- entryPoint?: string;
10
- tailwindConfig: string;
11
- }
12
-
13
- type TailwindOptions = TailwindOptionsWithConfig | TailwindOptionsWithEntryPoint;
@@ -1,38 +0,0 @@
1
- import type { ConfigWithOverrides } from '..';
2
-
3
- /**
4
- * Granular options to configure the project service.
5
- */
6
- interface ProjectServiceOptions {
7
- /**
8
- * Globs of files to allow running with the default project compiler options
9
- * despite not being matched by the project service.
10
- */
11
- allowDefaultProject?: string[];
12
-
13
- /**
14
- * Path to a TSConfig to use instead of TypeScript's default project configuration.
15
- * @default 'tsconfig.json'
16
- */
17
- defaultProject?: string;
18
-
19
- /**
20
- * Whether to allow TypeScript plugins as configured in the TSConfig.
21
- */
22
- loadTypeScriptPlugins?: boolean;
23
-
24
- /**
25
- * The maximum number of files {@link allowDefaultProject} may match.
26
- * Each file match slows down linting, so if you do need to use this, please
27
- * file an informative issue on typescript-eslint explaining why - so we can
28
- * help you avoid using it!
29
- * @default 8
30
- */
31
- maximumDefaultProjectFileMatchCount_THIS_WILL_SLOW_DOWN_LINTING?: number;
32
- }
33
-
34
- interface TypeScriptOptions extends ConfigWithOverrides {
35
- projectService?: boolean | ProjectServiceOptions;
36
- tsconfigRootDir?: string;
37
- cacheLifetime?: number;
38
- }
@@ -1,25 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.strict = exports.predicate = void 0;
7
- /**
8
- * @param {{strict?: boolean}} options
9
- * @param {import('eslint').Linter.RuleEntry} config
10
- * @returns {import('eslint').Linter.RuleEntry}
11
- */
12
- const strict = (options, config) => {
13
- return options.strict ? config : 'off';
14
- };
15
-
16
- /**
17
- * @param {boolean} options
18
- * @param {import('eslint').Linter.RulesRecord} config
19
- * @returns {import('eslint').Linter.RulesRecord | undefined}
20
- */
21
- exports.strict = strict;
22
- const predicate = (condition, config) => {
23
- return condition ? config : undefined;
24
- };
25
- exports.predicate = predicate;
@@ -1,35 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getGitignorePatterns = getGitignorePatterns;
7
- var _compat = require("@eslint/compat");
8
- var _nodeFs = _interopRequireDefault(require("node:fs"));
9
- var _nodePath = _interopRequireDefault(require("node:path"));
10
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
- /* eslint 'no-console': ['warn', { allow: ['warn'] }] */
12
-
13
- const warningMessage = '\u001B[38;2;229;229;14mWarning:\u001B[0m';
14
- const fallbackMessage = 'Falling back to default ignore patterns. You can suppress this warning by setting \u001B[48;5;234m`gitignore: false`\u001B[0m in the config.';
15
-
16
- /**
17
- * @param {string} gitignorePath relative path to the .gitignore file
18
- * @returns {string[]}
19
- */
20
- function getGitignorePatterns(gitignorePath) {
21
- const gitignoreAbsolutePath = _nodePath.default.resolve(process.cwd(), gitignorePath);
22
- const gitignoreExists = _nodeFs.default.existsSync(gitignoreAbsolutePath); // eslint-disable-line n/no-sync
23
- const gitignorePatterns = [];
24
- if (!gitignoreExists) {
25
- console.warn(warningMessage, `No .gitignore file found at "${gitignoreAbsolutePath}".`, fallbackMessage);
26
- return gitignorePatterns;
27
- }
28
- const ignorePatterns = (0, _compat.includeIgnoreFile)(gitignoreAbsolutePath).ignores ?? [];
29
- if (ignorePatterns.length > 0) {
30
- gitignorePatterns.push(...ignorePatterns);
31
- } else {
32
- console.warn(warningMessage, `No patterns found in .gitignore file at "${gitignoreAbsolutePath}".`, fallbackMessage);
33
- }
34
- return gitignorePatterns;
35
- }
@@ -1,37 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.ignoreGlobs = exports.globs = exports.allSrc = void 0;
7
- const srcExt = '?([cm])[jt]s?(x)';
8
- const globs = exports.globs = {
9
- src: `**/*.${srcExt}`,
10
- js: '**/*.?([cm])js',
11
- jsx: '**/*.?([cm])jsx',
12
- ts: '**/*.?([cm])ts',
13
- tsx: '**/*.?([cm])tsx',
14
- style: '**/*.{css,less,scss}',
15
- css: '**/*.css',
16
- postcss: '**/*.postcss',
17
- less: '**/*.less',
18
- scss: '**/*.scss',
19
- json: '**/*.json',
20
- json5: '**/*.json5',
21
- jsonc: '**/*.jsonc',
22
- allJson: '**/*.json?([c5])',
23
- md: '**/*.md',
24
- svelte: '**/*.svelte',
25
- vue: '**/*.vue',
26
- yaml: '**/*.{yml,yaml}',
27
- toml: '**/*.toml',
28
- xml: '**/*.xml',
29
- html: '**/*.html',
30
- astro: '**/*.astro',
31
- graphql: '**/*.{gql,graphql}',
32
- storybook: ['**/*.stories.{js,mjs,cjs,jsx,ts,tsx}'],
33
- test: [`**/__tests__/*.${srcExt}`, `**/*.spec.${srcExt}`, `**/*.test.${srcExt}`],
34
- e2e: [`**/e2e/*.${srcExt}`]
35
- };
36
- const allSrc = exports.allSrc = [globs.src, globs.style, globs.allJson, globs.md, globs.svelte, globs.vue, globs.yaml, globs.xml, globs.html];
37
- const ignoreGlobs = exports.ignoreGlobs = ['**/node_modules', '**/dist', '**/package-lock.json', '**/yarn.lock', '**/pnpm-lock.yaml', '**/bun.lockb', '**/output', '**/coverage', '**/temp', '**/.temp', '**/tmp', '**/.tmp', '**/.nx', '**/.history', '**/.vitepress/cache', '**/.nuxt', '**/.next', '**/.vercel', '**/.changeset', '**/.idea', '**/.cache', '**/.output', '**/.vite-inspect', '**/.yarn', '**/LICENSE*', '**/*.min.*', '**/__snapshots__'];
@@ -1,63 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.namingConvention = void 0;
7
- const namingConvention = exports.namingConvention = [{
8
- selector: 'default',
9
- format: ['camelCase'],
10
- filter: {
11
- regex: '^_+$',
12
- match: false
13
- }
14
- }, {
15
- selector: 'import',
16
- format: null
17
- }, {
18
- selector: 'function',
19
- format: ['camelCase', 'PascalCase']
20
- },
21
- // variables, CONSTANTS, ReactComponents
22
- {
23
- selector: 'variable',
24
- format: ['camelCase', 'UPPER_CASE', 'PascalCase'],
25
- filter: {
26
- regex: '^_+$',
27
- match: false
28
- }
29
- }, {
30
- selector: 'parameter',
31
- format: ['camelCase', 'PascalCase'],
32
- leadingUnderscore: 'allow',
33
- filter: {
34
- regex: '^_+$',
35
- match: false
36
- }
37
- }, {
38
- selector: 'memberLike',
39
- format: null
40
- }, {
41
- selector: 'memberLike',
42
- modifiers: ['static'],
43
- format: ['camelCase', 'PascalCase'],
44
- leadingUnderscore: 'allow'
45
- }, {
46
- selector: 'memberLike',
47
- modifiers: ['private'],
48
- format: ['camelCase'],
49
- leadingUnderscore: 'allow'
50
- }, {
51
- selector: 'typeLike',
52
- format: ['PascalCase']
53
- }, {
54
- selector: 'enumMember',
55
- format: ['PascalCase']
56
- }, {
57
- selector: 'interface',
58
- format: ['PascalCase'],
59
- custom: {
60
- regex: '^I[A-Z]',
61
- match: false
62
- }
63
- }];
@@ -1,7 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.nextAllowExportNames = void 0;
7
- const nextAllowExportNames = exports.nextAllowExportNames = ['experimental_ppr', 'dynamic', 'dynamicParams', 'revalidate', 'fetchCache', 'runtime', 'preferredRegion', 'maxDuration', 'metadata', 'generateMetadata', 'viewport', 'generateViewport', 'generateImageMetadata', 'generateSitemaps', 'generateStaticParams'];
@@ -1,14 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.objectOrEmpty = objectOrEmpty;
7
- /**
8
- * @template T
9
- * @param {T | null | undefined} value
10
- * @returns {T | {}}
11
- */
12
- function objectOrEmpty(value) {
13
- return typeof value === 'object' && value !== null ? value : {};
14
- }