eslint-plugin-spellbookx 0.1.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.
- package/LICENSE +21 -0
- package/README.md +190 -0
- package/dist/configs/astro.d.ts +4 -0
- package/dist/configs/astro.d.ts.map +1 -0
- package/dist/configs/astro.js +73 -0
- package/dist/configs/cspell.d.ts +4 -0
- package/dist/configs/cspell.d.ts.map +1 -0
- package/dist/configs/cspell.js +10 -0
- package/dist/configs/ignores.d.ts +4 -0
- package/dist/configs/ignores.d.ts.map +1 -0
- package/dist/configs/ignores.js +88 -0
- package/dist/configs/index.d.ts +15 -0
- package/dist/configs/index.d.ts.map +1 -0
- package/dist/configs/index.js +14 -0
- package/dist/configs/javascript.d.ts +4 -0
- package/dist/configs/javascript.d.ts.map +1 -0
- package/dist/configs/javascript.js +79 -0
- package/dist/configs/json.d.ts +4 -0
- package/dist/configs/json.d.ts.map +1 -0
- package/dist/configs/json.js +57 -0
- package/dist/configs/markdown.d.ts +4 -0
- package/dist/configs/markdown.d.ts.map +1 -0
- package/dist/configs/markdown.js +21 -0
- package/dist/configs/prettier.d.ts +4 -0
- package/dist/configs/prettier.d.ts.map +1 -0
- package/dist/configs/prettier.js +19 -0
- package/dist/configs/react.d.ts +4 -0
- package/dist/configs/react.d.ts.map +1 -0
- package/dist/configs/react.js +61 -0
- package/dist/configs/recommended/astro.d.ts +4 -0
- package/dist/configs/recommended/astro.d.ts.map +1 -0
- package/dist/configs/recommended/astro.js +18 -0
- package/dist/configs/recommended/index.d.ts +7 -0
- package/dist/configs/recommended/index.d.ts.map +1 -0
- package/dist/configs/recommended/index.js +6 -0
- package/dist/configs/recommended/no-spellcheck-astro.d.ts +4 -0
- package/dist/configs/recommended/no-spellcheck-astro.d.ts.map +1 -0
- package/dist/configs/recommended/no-spellcheck-astro.js +16 -0
- package/dist/configs/recommended/no-spellcheck-react.d.ts +4 -0
- package/dist/configs/recommended/no-spellcheck-react.d.ts.map +1 -0
- package/dist/configs/recommended/no-spellcheck-react.js +14 -0
- package/dist/configs/recommended/no-spellcheck.d.ts +4 -0
- package/dist/configs/recommended/no-spellcheck.d.ts.map +1 -0
- package/dist/configs/recommended/no-spellcheck.js +14 -0
- package/dist/configs/recommended/react.d.ts +4 -0
- package/dist/configs/recommended/react.d.ts.map +1 -0
- package/dist/configs/recommended/react.js +16 -0
- package/dist/configs/recommended/recommended.d.ts +4 -0
- package/dist/configs/recommended/recommended.d.ts.map +1 -0
- package/dist/configs/recommended/recommended.js +22 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +49 -0
- package/dist/shared-rules/index.d.ts +4 -0
- package/dist/shared-rules/index.d.ts.map +1 -0
- package/dist/shared-rules/index.js +3 -0
- package/dist/shared-rules/js-common.d.ts +25 -0
- package/dist/shared-rules/js-common.d.ts.map +1 -0
- package/dist/shared-rules/js-common.js +50 -0
- package/dist/shared-rules/js-imports-exports.d.ts +16 -0
- package/dist/shared-rules/js-imports-exports.d.ts.map +1 -0
- package/dist/shared-rules/js-imports-exports.js +191 -0
- package/dist/shared-rules/jsdoc.d.ts +23 -0
- package/dist/shared-rules/jsdoc.d.ts.map +1 -0
- package/dist/shared-rules/jsdoc.js +62 -0
- package/dist/tsconfig.lib.tsbuildinfo +1 -0
- package/package.json +74 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { defineConfig } from 'eslint/config';
|
|
2
|
+
import configIgnores from './ignores.js';
|
|
3
|
+
const configPrettier = defineConfig([
|
|
4
|
+
configIgnores,
|
|
5
|
+
{
|
|
6
|
+
files: [
|
|
7
|
+
'**/*.js',
|
|
8
|
+
'**/*.jsx',
|
|
9
|
+
'**/*.ts',
|
|
10
|
+
'**/*.tsx',
|
|
11
|
+
'**/*.mjs',
|
|
12
|
+
'**/*.cjs',
|
|
13
|
+
],
|
|
14
|
+
rules: {
|
|
15
|
+
'prettier/prettier': 'off',
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
]);
|
|
19
|
+
export default configPrettier;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../src/configs/react.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAkBrC,QAAA,MAAM,WAAW,EAAE,MAAM,CAAC,MAAM,EAgD9B,CAAC;AAEH,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { defineConfig } from 'eslint/config';
|
|
2
|
+
import importPlugin from 'eslint-plugin-import';
|
|
3
|
+
import nodeDependencies from 'eslint-plugin-node-dependencies';
|
|
4
|
+
import prettierPlugin from 'eslint-plugin-prettier';
|
|
5
|
+
import simpleImportSort from 'eslint-plugin-simple-import-sort';
|
|
6
|
+
import unicorn from 'eslint-plugin-unicorn';
|
|
7
|
+
import globals from 'globals';
|
|
8
|
+
import tseslint from 'typescript-eslint';
|
|
9
|
+
import js from '@eslint/js';
|
|
10
|
+
import eslintReact from '@eslint-react/eslint-plugin';
|
|
11
|
+
import { jsRulesCommon } from '../shared-rules/js-common.js';
|
|
12
|
+
import { jsRulesImportsExports } from '../shared-rules/js-imports-exports.js';
|
|
13
|
+
import configIgnores from './ignores.js';
|
|
14
|
+
import configJavascript from './javascript.js';
|
|
15
|
+
import configPrettier from './prettier.js';
|
|
16
|
+
const configReact = defineConfig([
|
|
17
|
+
configIgnores,
|
|
18
|
+
configJavascript,
|
|
19
|
+
// --- React ---
|
|
20
|
+
{
|
|
21
|
+
files: ['**/*.{jsx,tsx,mjsx,mtsx}'],
|
|
22
|
+
plugins: {
|
|
23
|
+
import: importPlugin,
|
|
24
|
+
prettier: prettierPlugin,
|
|
25
|
+
'simple-import-sort': simpleImportSort,
|
|
26
|
+
},
|
|
27
|
+
extends: [
|
|
28
|
+
js.configs.recommended,
|
|
29
|
+
...tseslint.configs.recommended,
|
|
30
|
+
eslintReact.configs['recommended-typescript'],
|
|
31
|
+
nodeDependencies.configs['flat/recommended'],
|
|
32
|
+
unicorn.configs.recommended,
|
|
33
|
+
],
|
|
34
|
+
languageOptions: {
|
|
35
|
+
sourceType: 'module',
|
|
36
|
+
globals: {
|
|
37
|
+
...globals.browser,
|
|
38
|
+
...globals.es2022,
|
|
39
|
+
},
|
|
40
|
+
parser: tseslint.parser,
|
|
41
|
+
parserOptions: {
|
|
42
|
+
projectService: true,
|
|
43
|
+
tsconfigRootDir: import.meta.dirname,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
rules: {
|
|
47
|
+
// Common rules
|
|
48
|
+
...jsRulesCommon,
|
|
49
|
+
...jsRulesImportsExports,
|
|
50
|
+
// Unicorn
|
|
51
|
+
'unicorn/filename-case': 'off',
|
|
52
|
+
// Prettier
|
|
53
|
+
'prettier/prettier': 'error',
|
|
54
|
+
},
|
|
55
|
+
settings: {
|
|
56
|
+
react: { version: 'detect' },
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
configPrettier,
|
|
60
|
+
]);
|
|
61
|
+
export default configReact;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"astro.d.ts","sourceRoot":"","sources":["../../../src/configs/recommended/astro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAWrC,QAAA,MAAM,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAQzC,CAAC;AAEH,eAAe,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { defineConfig } from 'eslint/config';
|
|
2
|
+
import configAstro from '../astro.js';
|
|
3
|
+
import configCSpell from '../cspell.js';
|
|
4
|
+
import configIgnores from '../ignores.js';
|
|
5
|
+
import configJson from '../json.js';
|
|
6
|
+
import configMarkdown from '../markdown.js';
|
|
7
|
+
import configPrettier from '../prettier.js';
|
|
8
|
+
import configReact from '../react.js';
|
|
9
|
+
const configRecommendedAstro = defineConfig([
|
|
10
|
+
configIgnores,
|
|
11
|
+
configCSpell,
|
|
12
|
+
configReact,
|
|
13
|
+
configAstro,
|
|
14
|
+
configJson,
|
|
15
|
+
configMarkdown,
|
|
16
|
+
configPrettier,
|
|
17
|
+
]);
|
|
18
|
+
export default configRecommendedAstro;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { default as configRecommendedAstro } from './astro.js';
|
|
2
|
+
export { default as configRecommendedNoSpellCheck } from './no-spellcheck.js';
|
|
3
|
+
export { default as configRecommendedNoSpellCheckAstro } from './no-spellcheck-astro.js';
|
|
4
|
+
export { default as configRecommendedNoSpellCheckReact } from './no-spellcheck-react.js';
|
|
5
|
+
export { default as configRecommendedReact } from './react.js';
|
|
6
|
+
export { default as configRecommended } from './recommended.js';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/configs/recommended/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,6BAA6B,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,OAAO,IAAI,kCAAkC,EAAE,MAAM,0BAA0B,CAAC;AACzF,OAAO,EAAE,OAAO,IAAI,kCAAkC,EAAE,MAAM,0BAA0B,CAAC;AACzF,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as configRecommendedAstro } from './astro.js';
|
|
2
|
+
export { default as configRecommendedNoSpellCheck } from './no-spellcheck.js';
|
|
3
|
+
export { default as configRecommendedNoSpellCheckAstro } from './no-spellcheck-astro.js';
|
|
4
|
+
export { default as configRecommendedNoSpellCheckReact } from './no-spellcheck-react.js';
|
|
5
|
+
export { default as configRecommendedReact } from './react.js';
|
|
6
|
+
export { default as configRecommended } from './recommended.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-spellcheck-astro.d.ts","sourceRoot":"","sources":["../../../src/configs/recommended/no-spellcheck-astro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAUrC,QAAA,MAAM,kCAAkC,EAAE,MAAM,CAAC,MAAM,EAOrD,CAAC;AAEH,eAAe,kCAAkC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { defineConfig } from 'eslint/config';
|
|
2
|
+
import configAstro from '../astro.js';
|
|
3
|
+
import configIgnores from '../ignores.js';
|
|
4
|
+
import configJson from '../json.js';
|
|
5
|
+
import configMarkdown from '../markdown.js';
|
|
6
|
+
import configPrettier from '../prettier.js';
|
|
7
|
+
import configReact from '../react.js';
|
|
8
|
+
const configRecommendedNoSpellCheckAstro = defineConfig([
|
|
9
|
+
configIgnores,
|
|
10
|
+
configReact,
|
|
11
|
+
configAstro,
|
|
12
|
+
configJson,
|
|
13
|
+
configMarkdown,
|
|
14
|
+
configPrettier,
|
|
15
|
+
]);
|
|
16
|
+
export default configRecommendedNoSpellCheckAstro;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-spellcheck-react.d.ts","sourceRoot":"","sources":["../../../src/configs/recommended/no-spellcheck-react.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AASrC,QAAA,MAAM,kCAAkC,EAAE,MAAM,CAAC,MAAM,EAMrD,CAAC;AAEH,eAAe,kCAAkC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { defineConfig } from 'eslint/config';
|
|
2
|
+
import configIgnores from '../ignores.js';
|
|
3
|
+
import configJson from '../json.js';
|
|
4
|
+
import configMarkdown from '../markdown.js';
|
|
5
|
+
import configPrettier from '../prettier.js';
|
|
6
|
+
import configReact from '../react.js';
|
|
7
|
+
const configRecommendedNoSpellCheckReact = defineConfig([
|
|
8
|
+
configIgnores,
|
|
9
|
+
configReact,
|
|
10
|
+
configJson,
|
|
11
|
+
configMarkdown,
|
|
12
|
+
configPrettier,
|
|
13
|
+
]);
|
|
14
|
+
export default configRecommendedNoSpellCheckReact;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-spellcheck.d.ts","sourceRoot":"","sources":["../../../src/configs/recommended/no-spellcheck.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AASrC,QAAA,MAAM,6BAA6B,EAAE,MAAM,CAAC,MAAM,EAMhD,CAAC;AAEH,eAAe,6BAA6B,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { defineConfig } from 'eslint/config';
|
|
2
|
+
import configIgnores from '../ignores.js';
|
|
3
|
+
import configJavascript from '../javascript.js';
|
|
4
|
+
import configJson from '../json.js';
|
|
5
|
+
import configMarkdown from '../markdown.js';
|
|
6
|
+
import configPrettier from '../prettier.js';
|
|
7
|
+
const configRecommendedNoSpellCheck = defineConfig([
|
|
8
|
+
configIgnores,
|
|
9
|
+
configJavascript,
|
|
10
|
+
configJson,
|
|
11
|
+
configMarkdown,
|
|
12
|
+
configPrettier,
|
|
13
|
+
]);
|
|
14
|
+
export default configRecommendedNoSpellCheck;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../../src/configs/recommended/react.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAUrC,QAAA,MAAM,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAOzC,CAAC;AAEH,eAAe,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { defineConfig } from 'eslint/config';
|
|
2
|
+
import configCSpell from '../cspell.js';
|
|
3
|
+
import configIgnores from '../ignores.js';
|
|
4
|
+
import configJson from '../json.js';
|
|
5
|
+
import configMarkdown from '../markdown.js';
|
|
6
|
+
import configPrettier from '../prettier.js';
|
|
7
|
+
import configReact from '../react.js';
|
|
8
|
+
const configRecommendedReact = defineConfig([
|
|
9
|
+
configIgnores,
|
|
10
|
+
configCSpell,
|
|
11
|
+
configReact,
|
|
12
|
+
configJson,
|
|
13
|
+
configMarkdown,
|
|
14
|
+
configPrettier,
|
|
15
|
+
]);
|
|
16
|
+
export default configRecommendedReact;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recommended.d.ts","sourceRoot":"","sources":["../../../src/configs/recommended/recommended.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAUrC,QAAA,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAapC,CAAC;AAEH,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { defineConfig } from 'eslint/config';
|
|
2
|
+
import configCSpell from '../cspell.js';
|
|
3
|
+
import configIgnores from '../ignores.js';
|
|
4
|
+
import configJavascript from '../javascript.js';
|
|
5
|
+
import configJson from '../json.js';
|
|
6
|
+
import configMarkdown from '../markdown.js';
|
|
7
|
+
import configPrettier from '../prettier.js';
|
|
8
|
+
const configRecommended = defineConfig([
|
|
9
|
+
configIgnores,
|
|
10
|
+
configCSpell,
|
|
11
|
+
configJavascript,
|
|
12
|
+
configJson,
|
|
13
|
+
configMarkdown,
|
|
14
|
+
configPrettier,
|
|
15
|
+
{
|
|
16
|
+
files: ['**/*.json', '**/*.json5', '**/*.jsonc'],
|
|
17
|
+
rules: {
|
|
18
|
+
'prettier/prettier': 'off',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
]);
|
|
22
|
+
export default configRecommended;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ESLint, Linter } from 'eslint';
|
|
2
|
+
type ConfigName = 'ignores' | 'javascript' | 'react' | 'json' | 'markdown' | 'cspell' | 'prettier' | 'recommended' | 'recommended-astro' | 'recommended-react' | 'recommended-no-spellcheck' | 'recommended-no-spellcheck-astro' | 'recommended-no-spellcheck-react';
|
|
3
|
+
declare const configs: Record<ConfigName, Linter.Config[]>;
|
|
4
|
+
type Plugin = ESLint.Plugin & {
|
|
5
|
+
configs: typeof configs;
|
|
6
|
+
};
|
|
7
|
+
declare const plugin: Plugin;
|
|
8
|
+
export default plugin;
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAgB7C,KAAK,UAAU,GACX,SAAS,GACT,YAAY,GACZ,OAAO,GACP,MAAM,GACN,UAAU,GACV,QAAQ,GACR,UAAU,GACV,aAAa,GACb,mBAAmB,GACnB,mBAAmB,GACnB,2BAA2B,GAC3B,iCAAiC,GACjC,iCAAiC,CAAC;AAQtC,QAAA,MAAM,OAAO,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,CA2BhD,CAAC;AAEF,KAAK,MAAM,GAAG,MAAM,CAAC,MAAM,GAAG;IAC5B,OAAO,EAAE,OAAO,OAAO,CAAC;CACzB,CAAC;AAEF,QAAA,MAAM,MAAM,EAAE,MASb,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import configCSpell from './configs/cspell.js';
|
|
3
|
+
import configIgnores from './configs/ignores.js';
|
|
4
|
+
import { configRecommendedNoSpellCheckAstro } from './configs/index.js';
|
|
5
|
+
import configJavascript from './configs/javascript.js';
|
|
6
|
+
import configJson from './configs/json.js';
|
|
7
|
+
import configMarkdown from './configs/markdown.js';
|
|
8
|
+
import configPrettier from './configs/prettier.js';
|
|
9
|
+
import configReact from './configs/react.js';
|
|
10
|
+
import configRecommendedAstro from './configs/recommended/astro.js';
|
|
11
|
+
import configRecommendedNoSpellCheck from './configs/recommended/no-spellcheck.js';
|
|
12
|
+
import configRecommendedNoSpellCheckReact from './configs/recommended/no-spellcheck-react.js';
|
|
13
|
+
import configRecommendedReact from './configs/recommended/react.js';
|
|
14
|
+
import configRecommended from './configs/recommended/recommended.js';
|
|
15
|
+
const packagePath = new URL('../package.json', import.meta.url);
|
|
16
|
+
const packageJson = JSON.parse(fs.readFileSync(packagePath, 'utf8'));
|
|
17
|
+
const configs = {
|
|
18
|
+
// global ignores
|
|
19
|
+
ignores: configIgnores,
|
|
20
|
+
// js/ts & react
|
|
21
|
+
javascript: configJavascript,
|
|
22
|
+
react: configReact,
|
|
23
|
+
// json
|
|
24
|
+
json: configJson,
|
|
25
|
+
// markdown
|
|
26
|
+
markdown: configMarkdown,
|
|
27
|
+
// spelling
|
|
28
|
+
cspell: configCSpell,
|
|
29
|
+
// prettier fixes
|
|
30
|
+
prettier: configPrettier,
|
|
31
|
+
// collections
|
|
32
|
+
recommended: configRecommended,
|
|
33
|
+
'recommended-astro': configRecommendedAstro,
|
|
34
|
+
'recommended-react': configRecommendedReact,
|
|
35
|
+
'recommended-no-spellcheck': configRecommendedNoSpellCheck,
|
|
36
|
+
'recommended-no-spellcheck-astro': configRecommendedNoSpellCheckAstro,
|
|
37
|
+
'recommended-no-spellcheck-react': configRecommendedNoSpellCheckReact,
|
|
38
|
+
};
|
|
39
|
+
const plugin = {
|
|
40
|
+
meta: {
|
|
41
|
+
name: packageJson.name,
|
|
42
|
+
version: packageJson.version,
|
|
43
|
+
namespace: 'spellbookx',
|
|
44
|
+
},
|
|
45
|
+
configs,
|
|
46
|
+
rules: {},
|
|
47
|
+
processors: {},
|
|
48
|
+
};
|
|
49
|
+
export default plugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/shared-rules/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Linter } from 'eslint';
|
|
2
|
+
/**
|
|
3
|
+
* ESLint configuration for JavaScript and TypeScript.
|
|
4
|
+
*
|
|
5
|
+
* This setup replaces the base ESLint `no-unused-vars` rule with
|
|
6
|
+
* `@typescript-eslint/no-unused-vars`, which understands TypeScript syntax
|
|
7
|
+
* (interfaces, types, enums, modules) and avoids false positives.
|
|
8
|
+
* It also enforces clean code style, safe modern JavaScript patterns,
|
|
9
|
+
* and proper documentation through **Prettier**, **Unicorn**, and **JSDoc**.
|
|
10
|
+
*
|
|
11
|
+
* **Required plugins:**
|
|
12
|
+
* - typescript
|
|
13
|
+
* - typescript-eslint
|
|
14
|
+
* - eslint-plugin-unicorn
|
|
15
|
+
* - eslint-plugin-prettier ('eslint-config-prettier' must be installed too)
|
|
16
|
+
* - eslint-plugin-jsdoc.
|
|
17
|
+
*
|
|
18
|
+
* **Register the plugins as follows:**
|
|
19
|
+
* - '@typescript-eslint': tseslint
|
|
20
|
+
* - unicorn: unicornPlugin
|
|
21
|
+
* - prettier: prettierPlugin
|
|
22
|
+
* - jsdoc: jsdoc.
|
|
23
|
+
*/
|
|
24
|
+
export declare const jsRulesCommon: Linter.RulesRecord;
|
|
25
|
+
//# sourceMappingURL=js-common.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"js-common.d.ts","sourceRoot":"","sources":["../../src/shared-rules/js-common.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,WA8BlC,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ESLint configuration for JavaScript and TypeScript.
|
|
3
|
+
*
|
|
4
|
+
* This setup replaces the base ESLint `no-unused-vars` rule with
|
|
5
|
+
* `@typescript-eslint/no-unused-vars`, which understands TypeScript syntax
|
|
6
|
+
* (interfaces, types, enums, modules) and avoids false positives.
|
|
7
|
+
* It also enforces clean code style, safe modern JavaScript patterns,
|
|
8
|
+
* and proper documentation through **Prettier**, **Unicorn**, and **JSDoc**.
|
|
9
|
+
*
|
|
10
|
+
* **Required plugins:**
|
|
11
|
+
* - typescript
|
|
12
|
+
* - typescript-eslint
|
|
13
|
+
* - eslint-plugin-unicorn
|
|
14
|
+
* - eslint-plugin-prettier ('eslint-config-prettier' must be installed too)
|
|
15
|
+
* - eslint-plugin-jsdoc.
|
|
16
|
+
*
|
|
17
|
+
* **Register the plugins as follows:**
|
|
18
|
+
* - '@typescript-eslint': tseslint
|
|
19
|
+
* - unicorn: unicornPlugin
|
|
20
|
+
* - prettier: prettierPlugin
|
|
21
|
+
* - jsdoc: jsdoc.
|
|
22
|
+
*/
|
|
23
|
+
export const jsRulesCommon = {
|
|
24
|
+
// TS: allow unused prefixed with "_"
|
|
25
|
+
'no-unused-vars': 'off',
|
|
26
|
+
'@typescript-eslint/no-unused-vars': [
|
|
27
|
+
'error',
|
|
28
|
+
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
|
|
29
|
+
],
|
|
30
|
+
// Quote/semi conflict resolution (Prettier handles)
|
|
31
|
+
quotes: 'off',
|
|
32
|
+
'@typescript-eslint/quotes': 'off',
|
|
33
|
+
semi: 'off',
|
|
34
|
+
'@typescript-eslint/semi': 'off',
|
|
35
|
+
// Unicorn
|
|
36
|
+
'unicorn/filename-case': ['error', { case: 'kebabCase' }],
|
|
37
|
+
'unicorn/prefer-module': 'error',
|
|
38
|
+
'unicorn/no-new-buffer': 'error',
|
|
39
|
+
'unicorn/no-instanceof-array': 'error',
|
|
40
|
+
'unicorn/prefer-includes': 'error',
|
|
41
|
+
'unicorn/prefer-string-replace-all': 'error',
|
|
42
|
+
'unicorn/prefer-top-level-await': 'off',
|
|
43
|
+
'unicorn/prefer-type-error': 'error',
|
|
44
|
+
'unicorn/throw-new-error': 'error',
|
|
45
|
+
'unicorn/no-null': 'off',
|
|
46
|
+
'unicorn/prevent-abbreviations': 'off',
|
|
47
|
+
'unicorn/explicit-length-check': 'warn',
|
|
48
|
+
// Prettier
|
|
49
|
+
'prettier/prettier': 'error',
|
|
50
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Linter } from 'eslint';
|
|
2
|
+
/**
|
|
3
|
+
* ESLint rules focused on enforcing structured and sorted imports and exports.
|
|
4
|
+
* This configuration disables the default 'sort-imports' rule and relies on
|
|
5
|
+
* 'eslint-plugin-simple-import-sort' for predictable grouping and sorting.
|
|
6
|
+
*
|
|
7
|
+
* **Required plugins:**
|
|
8
|
+
* - eslint-plugin-simple-import-sort
|
|
9
|
+
* - eslint-plugin-import.
|
|
10
|
+
*
|
|
11
|
+
* **Register plugins as:**
|
|
12
|
+
* - import: importPlugin
|
|
13
|
+
* - simple-import-sort: simpleImportSort.
|
|
14
|
+
*/
|
|
15
|
+
export declare const jsRulesImportsExports: Linter.RulesRecord;
|
|
16
|
+
//# sourceMappingURL=js-imports-exports.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"js-imports-exports.d.ts","sourceRoot":"","sources":["../../src/shared-rules/js-imports-exports.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAmMrC;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,WAS1C,CAAC"}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
const IMPORT_GROUPS = [
|
|
2
|
+
// dotenv & dotenvx packages
|
|
3
|
+
['^@dotenvx/dotenvx', '^dotenv'],
|
|
4
|
+
// Side-effect imports (e.g. polyfills)
|
|
5
|
+
[String.raw `^\u0000`],
|
|
6
|
+
// Env imports for React Native, Expo, etc.
|
|
7
|
+
['^@env'],
|
|
8
|
+
// Node.js built-in modules
|
|
9
|
+
[
|
|
10
|
+
'^assert',
|
|
11
|
+
'^buffer',
|
|
12
|
+
'^child_process',
|
|
13
|
+
'^cluster',
|
|
14
|
+
'^console',
|
|
15
|
+
'^constants',
|
|
16
|
+
'^crypto',
|
|
17
|
+
'^dgram',
|
|
18
|
+
'^dns',
|
|
19
|
+
'^domain',
|
|
20
|
+
'^events',
|
|
21
|
+
'^fs',
|
|
22
|
+
'^http',
|
|
23
|
+
'^https',
|
|
24
|
+
'^inspector',
|
|
25
|
+
'^module',
|
|
26
|
+
'^net',
|
|
27
|
+
'^os',
|
|
28
|
+
'^path',
|
|
29
|
+
'^perf_hooks',
|
|
30
|
+
'^process',
|
|
31
|
+
'^punycode',
|
|
32
|
+
'^querystring',
|
|
33
|
+
'^readline',
|
|
34
|
+
'^repl',
|
|
35
|
+
'^stream',
|
|
36
|
+
'^string_decoder',
|
|
37
|
+
'^timers',
|
|
38
|
+
'^tls',
|
|
39
|
+
'^tty',
|
|
40
|
+
'^url',
|
|
41
|
+
'^util',
|
|
42
|
+
'^v8',
|
|
43
|
+
'^vm',
|
|
44
|
+
'^zlib',
|
|
45
|
+
],
|
|
46
|
+
// Node.js built-in modules #2
|
|
47
|
+
['^node:'],
|
|
48
|
+
// Node.js backend frameworks
|
|
49
|
+
[
|
|
50
|
+
'^@fastify',
|
|
51
|
+
'^@hapi/hapi',
|
|
52
|
+
'^@koa/koa',
|
|
53
|
+
'^@nestjs',
|
|
54
|
+
'^express',
|
|
55
|
+
'^fastify',
|
|
56
|
+
'^hapi',
|
|
57
|
+
'^koa',
|
|
58
|
+
'^loopback',
|
|
59
|
+
'^nest',
|
|
60
|
+
'^sails',
|
|
61
|
+
],
|
|
62
|
+
// Node.js backend middlewares & utilities
|
|
63
|
+
[
|
|
64
|
+
'^body-parser',
|
|
65
|
+
'^connect-redis',
|
|
66
|
+
'^cookie-parser',
|
|
67
|
+
'^cors',
|
|
68
|
+
'^express-rate-limit',
|
|
69
|
+
'^express-session',
|
|
70
|
+
'^helmet',
|
|
71
|
+
'^morgan',
|
|
72
|
+
'^passport',
|
|
73
|
+
String.raw `^pino-`,
|
|
74
|
+
'^redis',
|
|
75
|
+
'^winston',
|
|
76
|
+
],
|
|
77
|
+
// UI Frameworks (React, Vue, Svelte, etc.)
|
|
78
|
+
['^@angular', '^react', '^solid-js', '^svelte', '^vue'],
|
|
79
|
+
// React specific packages
|
|
80
|
+
[
|
|
81
|
+
'^@tanstack/router',
|
|
82
|
+
'^react-dom',
|
|
83
|
+
'^react-helmet',
|
|
84
|
+
'^react-intl',
|
|
85
|
+
'^react-router',
|
|
86
|
+
'^react-router-dom',
|
|
87
|
+
],
|
|
88
|
+
// Full-stack/SSR frameworks (Next.js, Remix, etc.)
|
|
89
|
+
['^@nuxt/kit', '^@remix-run', '^@sveltejs/kit', '^gatsby', '^next'],
|
|
90
|
+
// React Native & Expo
|
|
91
|
+
[
|
|
92
|
+
'^@expo',
|
|
93
|
+
String.raw `^@expo\/`,
|
|
94
|
+
'^@react-native',
|
|
95
|
+
'^expo',
|
|
96
|
+
String.raw `^expo-`,
|
|
97
|
+
'^react-native',
|
|
98
|
+
'^react-navigation',
|
|
99
|
+
],
|
|
100
|
+
// State management libraries
|
|
101
|
+
[
|
|
102
|
+
'^@reduxjs/toolkit',
|
|
103
|
+
'^jotai',
|
|
104
|
+
'^mobx',
|
|
105
|
+
'^recoil',
|
|
106
|
+
'^redux',
|
|
107
|
+
'^valtio',
|
|
108
|
+
'^zustand',
|
|
109
|
+
],
|
|
110
|
+
// Data-fetching libraries
|
|
111
|
+
['^@apollo/client', '^@tanstack/react-query', '^axios', '^graphql', '^swr'],
|
|
112
|
+
// UI libraries & design systems
|
|
113
|
+
[
|
|
114
|
+
'^@chakra-ui',
|
|
115
|
+
'^@headlessui/react',
|
|
116
|
+
'^@lottiefiles',
|
|
117
|
+
'^@material-ui',
|
|
118
|
+
'^@mui',
|
|
119
|
+
'^@nextui-org/react',
|
|
120
|
+
'^@radix-ui',
|
|
121
|
+
'^antd',
|
|
122
|
+
'^framer-motion',
|
|
123
|
+
'^native-base',
|
|
124
|
+
'^react-native-paper',
|
|
125
|
+
'^shadcn-ui',
|
|
126
|
+
'^tailwindcss',
|
|
127
|
+
],
|
|
128
|
+
// CSS-in-JS & utility libraries
|
|
129
|
+
[
|
|
130
|
+
'^@emotion',
|
|
131
|
+
'^class-variance-authority',
|
|
132
|
+
'^clsx',
|
|
133
|
+
'^lucide-react',
|
|
134
|
+
'^styled-components',
|
|
135
|
+
'^tailwind-merge',
|
|
136
|
+
'^twin.macro',
|
|
137
|
+
'^tw-animate-css',
|
|
138
|
+
],
|
|
139
|
+
// Common icon packages
|
|
140
|
+
[
|
|
141
|
+
String.raw `^@expo\/vector-icons`,
|
|
142
|
+
'^@fortawesome',
|
|
143
|
+
'^@tabler/icons-react',
|
|
144
|
+
'^lucide',
|
|
145
|
+
'^react-feather',
|
|
146
|
+
'^react-icons',
|
|
147
|
+
'^react-native-feather',
|
|
148
|
+
'^react-native-vector-icons',
|
|
149
|
+
],
|
|
150
|
+
// Testing libraries and utilities
|
|
151
|
+
['^@testing-library', '^cypress', '^jest', '^playwright', '^vitest'],
|
|
152
|
+
// Generic third-party packages (npm scope and plain)
|
|
153
|
+
['^[a-z]', String.raw `^@\w`],
|
|
154
|
+
// Monorepo/workspace scoped packages
|
|
155
|
+
['^@my-org/', '^@workspace/'],
|
|
156
|
+
// Asset imports (images, fonts, etc.)
|
|
157
|
+
[
|
|
158
|
+
String.raw `^.+\.(avi|mkv|mov|mp4|webm)$`,
|
|
159
|
+
String.raw `^.+\.(mp3|ogg|wav|weba)$`,
|
|
160
|
+
String.raw `^.+\.(gif|jpe?g|png|svg|webp)$`,
|
|
161
|
+
String.raw `^.+\.lottie$`,
|
|
162
|
+
String.raw `^.+\.(eot|otf|ttf|woff|woff2)$`,
|
|
163
|
+
],
|
|
164
|
+
// JSON files
|
|
165
|
+
[String.raw `^.+\.json$`],
|
|
166
|
+
// Stylesheets (css, scss, less, etc.)
|
|
167
|
+
[String.raw `^.+\.less$`, String.raw `^.+\.s?css$`],
|
|
168
|
+
// Relative imports (parent, sibling, current)
|
|
169
|
+
[String.raw `^\.?\.\/`],
|
|
170
|
+
];
|
|
171
|
+
/**
|
|
172
|
+
* ESLint rules focused on enforcing structured and sorted imports and exports.
|
|
173
|
+
* This configuration disables the default 'sort-imports' rule and relies on
|
|
174
|
+
* 'eslint-plugin-simple-import-sort' for predictable grouping and sorting.
|
|
175
|
+
*
|
|
176
|
+
* **Required plugins:**
|
|
177
|
+
* - eslint-plugin-simple-import-sort
|
|
178
|
+
* - eslint-plugin-import.
|
|
179
|
+
*
|
|
180
|
+
* **Register plugins as:**
|
|
181
|
+
* - import: importPlugin
|
|
182
|
+
* - simple-import-sort: simpleImportSort.
|
|
183
|
+
*/
|
|
184
|
+
export const jsRulesImportsExports = {
|
|
185
|
+
// Disable the built-in sort-imports rule in favor of plugin
|
|
186
|
+
'sort-imports': 'off',
|
|
187
|
+
// Enforce structured and grouped imports using simple-import-sort
|
|
188
|
+
'simple-import-sort/imports': ['error', { groups: IMPORT_GROUPS }],
|
|
189
|
+
// Enforce sorted exports
|
|
190
|
+
'simple-import-sort/exports': 'error',
|
|
191
|
+
};
|