@polariens/kitsune-lint 1.0.0-rc.10
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 +268 -0
- package/bin/copy-prettierignore.mjs +30 -0
- package/eslint/configs/base.d.mts +10 -0
- package/eslint/configs/base.mjs +28 -0
- package/eslint/configs/clean-code.d.mts +20 -0
- package/eslint/configs/clean-code.mjs +102 -0
- package/eslint/configs/pinia.d.mts +10 -0
- package/eslint/configs/pinia.mjs +36 -0
- package/eslint/configs/security.d.mts +12 -0
- package/eslint/configs/security.mjs +46 -0
- package/eslint/configs/tests.d.mts +10 -0
- package/eslint/configs/tests.mjs +40 -0
- package/eslint/configs/typescript.d.mts +14 -0
- package/eslint/configs/typescript.mjs +216 -0
- package/eslint/configs/vitest.d.mts +20 -0
- package/eslint/configs/vitest.mjs +76 -0
- package/eslint/configs/vue.d.mts +25 -0
- package/eslint/configs/vue.mjs +73 -0
- package/eslint/index.d.mts +51 -0
- package/eslint/index.mjs +85 -0
- package/eslint/rules/no-null-in-types.mjs +117 -0
- package/eslint/utils.d.mts +7 -0
- package/eslint/utils.mjs +33 -0
- package/package.json +119 -0
- package/prettier/.prettierignore +14 -0
- package/prettier/index.d.mts +50 -0
- package/prettier/index.mjs +77 -0
package/eslint/utils.mjs
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export const FILE_PATTERNS = {
|
|
2
|
+
all: ['**/*.{vue,js,mjs,cjs,ts}'],
|
|
3
|
+
tests: ['tests/**/*.{js,mjs,cjs,ts}'],
|
|
4
|
+
vue: ['**/*.vue'],
|
|
5
|
+
pinia: ['src/state/**/*.{ts}'],
|
|
6
|
+
configs: ['**/*.config.{js,mjs,cjs,ts}'],
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const IGNORE_PATTERNS = [
|
|
10
|
+
'coverage',
|
|
11
|
+
'dist',
|
|
12
|
+
'node_modules',
|
|
13
|
+
'.gemini/',
|
|
14
|
+
'.agents/',
|
|
15
|
+
'.agent/',
|
|
16
|
+
'.cursor/',
|
|
17
|
+
'.claude/',
|
|
18
|
+
'.copilot/',
|
|
19
|
+
'.ia/',
|
|
20
|
+
'.prompt/',
|
|
21
|
+
'.planning/'
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Mescla file patterns customizados com os padrões.
|
|
26
|
+
* @param {string} key - Chave do FILE_PATTERNS a usar como base
|
|
27
|
+
* @param {string[] | undefined} custom - Patterns adicionais do consumidor
|
|
28
|
+
* @returns {string[]}
|
|
29
|
+
*/
|
|
30
|
+
export function resolveFiles(key, custom) {
|
|
31
|
+
if (custom) return custom;
|
|
32
|
+
return FILE_PATTERNS[key] ?? FILE_PATTERNS.all;
|
|
33
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@polariens/kitsune-lint",
|
|
3
|
+
"version": "1.0.0-rc.10",
|
|
4
|
+
"description": "Opinionated ESLint & Prettier configs for high-quality Vue, TypeScript & Vitest projects. Clean code, sharp rules.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"eslint",
|
|
7
|
+
"prettier",
|
|
8
|
+
"lint",
|
|
9
|
+
"config",
|
|
10
|
+
"vue",
|
|
11
|
+
"typescript",
|
|
12
|
+
"vitest",
|
|
13
|
+
"clean-code",
|
|
14
|
+
"pinia",
|
|
15
|
+
"kitsune"
|
|
16
|
+
],
|
|
17
|
+
"homepage": "https://github.com/Merieli/kitsune-lint#readme",
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/Merieli/kitsune-lint/issues"
|
|
20
|
+
},
|
|
21
|
+
"repository": {
|
|
22
|
+
"type": "git",
|
|
23
|
+
"url": "git+https://github.com/Merieli/kitsune-lint.git"
|
|
24
|
+
},
|
|
25
|
+
"license": "MIT",
|
|
26
|
+
"author": "Polariens",
|
|
27
|
+
"type": "module",
|
|
28
|
+
"exports": {
|
|
29
|
+
".": {
|
|
30
|
+
"types": "./eslint/index.d.mts",
|
|
31
|
+
"default": "./eslint/index.mjs"
|
|
32
|
+
},
|
|
33
|
+
"./eslint": {
|
|
34
|
+
"types": "./eslint/index.d.mts",
|
|
35
|
+
"default": "./eslint/index.mjs"
|
|
36
|
+
},
|
|
37
|
+
"./eslint/base": {
|
|
38
|
+
"types": "./eslint/configs/base.d.mts",
|
|
39
|
+
"default": "./eslint/configs/base.mjs"
|
|
40
|
+
},
|
|
41
|
+
"./eslint/typescript": {
|
|
42
|
+
"types": "./eslint/configs/typescript.d.mts",
|
|
43
|
+
"default": "./eslint/configs/typescript.mjs"
|
|
44
|
+
},
|
|
45
|
+
"./eslint/security": {
|
|
46
|
+
"types": "./eslint/configs/security.d.mts",
|
|
47
|
+
"default": "./eslint/configs/security.mjs"
|
|
48
|
+
},
|
|
49
|
+
"./eslint/clean-code": {
|
|
50
|
+
"types": "./eslint/configs/clean-code.d.mts",
|
|
51
|
+
"default": "./eslint/configs/clean-code.mjs"
|
|
52
|
+
},
|
|
53
|
+
"./eslint/vue": {
|
|
54
|
+
"types": "./eslint/configs/vue.d.mts",
|
|
55
|
+
"default": "./eslint/configs/vue.mjs"
|
|
56
|
+
},
|
|
57
|
+
"./eslint/pinia": {
|
|
58
|
+
"types": "./eslint/configs/pinia.d.mts",
|
|
59
|
+
"default": "./eslint/configs/pinia.mjs"
|
|
60
|
+
},
|
|
61
|
+
"./eslint/tests": {
|
|
62
|
+
"types": "./eslint/configs/tests.d.mts",
|
|
63
|
+
"default": "./eslint/configs/tests.mjs"
|
|
64
|
+
},
|
|
65
|
+
"./eslint/vitest": {
|
|
66
|
+
"types": "./eslint/configs/vitest.d.mts",
|
|
67
|
+
"default": "./eslint/configs/vitest.mjs"
|
|
68
|
+
},
|
|
69
|
+
"./prettier": {
|
|
70
|
+
"types": "./prettier/index.d.mts",
|
|
71
|
+
"default": "./prettier/index.mjs"
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
"main": "index.js",
|
|
75
|
+
"bin": {
|
|
76
|
+
"kitsune-prettierignore": "bin/copy-prettierignore.mjs"
|
|
77
|
+
},
|
|
78
|
+
"directories": {
|
|
79
|
+
"example": "examples"
|
|
80
|
+
},
|
|
81
|
+
"files": [
|
|
82
|
+
"eslint",
|
|
83
|
+
"prettier",
|
|
84
|
+
"bin"
|
|
85
|
+
],
|
|
86
|
+
"scripts": {
|
|
87
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
88
|
+
},
|
|
89
|
+
"dependencies": {
|
|
90
|
+
"globals": "^17.4.0"
|
|
91
|
+
},
|
|
92
|
+
"peerDependencies": {
|
|
93
|
+
"@eslint/js": "^9.0.0",
|
|
94
|
+
"@vitest/eslint-plugin": "^1.0.0",
|
|
95
|
+
"eslint": ">=9.0.0",
|
|
96
|
+
"eslint-plugin-pinia": "^0.4.0",
|
|
97
|
+
"eslint-plugin-security": "^4.0.0",
|
|
98
|
+
"eslint-plugin-vue": "^10.0.0",
|
|
99
|
+
"typescript-eslint": "^8.0.0",
|
|
100
|
+
"vue-eslint-parser": "^10.0.0"
|
|
101
|
+
},
|
|
102
|
+
"peerDependenciesMeta": {
|
|
103
|
+
"@vitest/eslint-plugin": {
|
|
104
|
+
"optional": true
|
|
105
|
+
},
|
|
106
|
+
"eslint-plugin-security": {
|
|
107
|
+
"optional": true
|
|
108
|
+
},
|
|
109
|
+
"eslint-plugin-vue": {
|
|
110
|
+
"optional": true
|
|
111
|
+
},
|
|
112
|
+
"vue-eslint-parser": {
|
|
113
|
+
"optional": true
|
|
114
|
+
},
|
|
115
|
+
"eslint-plugin-pinia": {
|
|
116
|
+
"optional": true
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export interface PrettierKitsuneConfig {
|
|
2
|
+
/** Largura máxima da linha @default 100 */
|
|
3
|
+
printWidth?: number;
|
|
4
|
+
/** Espaços por nível de indentação @default 2 */
|
|
5
|
+
tabWidth?: number;
|
|
6
|
+
/** Usar tabs ao invés de espaços @default false */
|
|
7
|
+
useTabs?: boolean;
|
|
8
|
+
/** Adicionar ponto e vírgula no final @default true */
|
|
9
|
+
semi?: boolean;
|
|
10
|
+
/** Usar aspas simples @default true */
|
|
11
|
+
singleQuote?: boolean;
|
|
12
|
+
/** Estilo de trailing comma @default 'es5' */
|
|
13
|
+
trailingComma?: 'all' | 'es5' | 'none';
|
|
14
|
+
/** Espaços dentro de chaves de objetos @default true */
|
|
15
|
+
bracketSpacing?: boolean;
|
|
16
|
+
/** Colocar > de tags na mesma linha @default false */
|
|
17
|
+
bracketSameLine?: boolean;
|
|
18
|
+
/** Parênteses em arrow functions @default 'always' */
|
|
19
|
+
arrowParens?: 'always' | 'avoid';
|
|
20
|
+
/** Quebra de linha em prosa (markdown) @default 'never' */
|
|
21
|
+
proseWrap?: 'always' | 'never' | 'preserve';
|
|
22
|
+
/** Sensibilidade a espaços em HTML @default 'strict' */
|
|
23
|
+
htmlWhitespaceSensitivity?: 'css' | 'strict' | 'ignore';
|
|
24
|
+
/** Estilo de fim de linha @default 'lf' */
|
|
25
|
+
endOfLine?: 'lf' | 'crlf' | 'cr' | 'auto';
|
|
26
|
+
/** Aspas em propriedades de objeto @default 'as-needed' */
|
|
27
|
+
quoteProps?: 'as-needed' | 'consistent' | 'preserve';
|
|
28
|
+
/** Formatar código embutido em template literals @default 'auto' */
|
|
29
|
+
embeddedLanguageFormatting?: 'auto' | 'off';
|
|
30
|
+
/** Indentação dentro de <script> e <style> em Vue SFCs @default false */
|
|
31
|
+
vueIndentScriptAndStyle?: boolean;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** Opções para a factory createPrettierKitsuneConfig */
|
|
35
|
+
export interface CreatePrettierKitsuneOptions {
|
|
36
|
+
/** Overrides das regras originais do Prettier */
|
|
37
|
+
overrides?: Partial<PrettierKitsuneConfig>;
|
|
38
|
+
/**
|
|
39
|
+
* Atalho para habilitar a indentação de script e style no Vue.
|
|
40
|
+
* Se true, sobrescreve o valor em overrides.
|
|
41
|
+
* @default false
|
|
42
|
+
*/
|
|
43
|
+
vue?: boolean;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export declare const prettierKitsuneConfig: PrettierKitsuneConfig;
|
|
47
|
+
|
|
48
|
+
export declare function createPrettierKitsuneConfig(
|
|
49
|
+
options?: CreatePrettierKitsuneOptions
|
|
50
|
+
): PrettierKitsuneConfig;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} PrettierKitsuneOptions
|
|
3
|
+
* @property {number} [printWidth=100]
|
|
4
|
+
* @property {number} [tabWidth=2]
|
|
5
|
+
* @property {boolean} [useTabs=false]
|
|
6
|
+
* @property {boolean} [semi=true]
|
|
7
|
+
* @property {boolean} [singleQuote=true]
|
|
8
|
+
* @property {'all' | 'es5' | 'none'} [trailingComma='es5']
|
|
9
|
+
* @property {boolean} [bracketSpacing=true]
|
|
10
|
+
* @property {boolean} [bracketSameLine=false]
|
|
11
|
+
* @property {'always' | 'avoid'} [arrowParens='always']
|
|
12
|
+
* @property {'always' | 'never' | 'preserve'} [proseWrap='never']
|
|
13
|
+
* @property {'css' | 'strict' | 'ignore'} [htmlWhitespaceSensitivity='strict']
|
|
14
|
+
* @property {'lf' | 'crlf' | 'cr' | 'auto'} [endOfLine='lf']
|
|
15
|
+
* @property {'as-needed' | 'consistent' | 'preserve'} [quoteProps='as-needed']
|
|
16
|
+
* @property {'auto' | 'off'} [embeddedLanguageFormatting='auto']
|
|
17
|
+
* @property {boolean} [vueIndentScriptAndStyle=false]
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/** @type {PrettierKitsuneOptions} */
|
|
21
|
+
const defaults = {
|
|
22
|
+
printWidth: 100,
|
|
23
|
+
tabWidth: 2,
|
|
24
|
+
useTabs: false,
|
|
25
|
+
semi: true,
|
|
26
|
+
singleQuote: true,
|
|
27
|
+
trailingComma: 'es5',
|
|
28
|
+
bracketSpacing: true,
|
|
29
|
+
bracketSameLine: false,
|
|
30
|
+
arrowParens: 'always',
|
|
31
|
+
proseWrap: 'never',
|
|
32
|
+
htmlWhitespaceSensitivity: 'strict',
|
|
33
|
+
endOfLine: 'lf',
|
|
34
|
+
quoteProps: 'as-needed',
|
|
35
|
+
embeddedLanguageFormatting: 'auto',
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Configuração Prettier padrão.
|
|
40
|
+
* Importar diretamente para usar sem modificações.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* // prettier.config.mjs
|
|
44
|
+
* import { prettierKitsuneConfig } from '@polariens/kitsune-lint/prettier';
|
|
45
|
+
* export default prettierKitsuneConfig;
|
|
46
|
+
*/
|
|
47
|
+
const prettierKitsuneConfig = { ...defaults };
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* @typedef {Object} Options
|
|
51
|
+
* @property {boolean} [vue=false] - Habilita configurações relacionadas ao Vue, como vueIndentScriptAndStyle
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Factory para criar config Prettier com opções.
|
|
56
|
+
*
|
|
57
|
+
* @param {Object} [options={}]
|
|
58
|
+
* @param {Partial<PrettierKitsuneOptions>} [options.overrides={}] - Overrides diretos do Prettier
|
|
59
|
+
* @param {boolean} [options.vue=false] - Se deve indentar script/style no Vue
|
|
60
|
+
* @returns {PrettierKitsuneOptions}
|
|
61
|
+
*/
|
|
62
|
+
function createPrettierKitsuneConfig(options = {}) {
|
|
63
|
+
const { overrides = {}, vue = false } = options;
|
|
64
|
+
|
|
65
|
+
const config = {
|
|
66
|
+
...defaults,
|
|
67
|
+
...overrides
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
if (vue) {
|
|
71
|
+
config.vueIndentScriptAndStyle = true;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return config;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export { createPrettierKitsuneConfig, prettierKitsuneConfig as default };
|