hard-lint 0.2.0 → 0.3.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/dist/config.d.ts +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/preset.d.ts +80 -0
- package/dist/preset.d.ts.map +1 -0
- package/dist/preset.js +109 -0
- package/dist/preset.js.map +1 -0
- package/package.json +11 -1
package/dist/config.d.ts
CHANGED
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/D;;;;;GAKG;AACH,wBAAgB,oBAAoB,IAAI,YAAY,EAAE,CAkBrD;AAED;;GAEG;AACH,eAAO,MAAM,QAAQ;;;;CAIpB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,OAAO;IAClB;;OAEG;kBACS,cAAc;IAM1B;;OAEG;oBACW,cAAc;IAM5B;;OAEG;mBACU,cAAc;CAK5B,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* hard-lint
|
|
3
3
|
* Configuração rigorosa de ESLint para projetos TypeScript
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
6
|
-
export {
|
|
5
|
+
export { default } from './preset.js';
|
|
6
|
+
export type { HardLintConfig } from './types.js';
|
|
7
|
+
export { createHardLintConfig, PRESETS, SEVERITY } from './config.js';
|
|
7
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,YAAY,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -2,5 +2,6 @@
|
|
|
2
2
|
* hard-lint
|
|
3
3
|
* Configuração rigorosa de ESLint para projetos TypeScript
|
|
4
4
|
*/
|
|
5
|
-
export {
|
|
5
|
+
export { default } from './preset.js';
|
|
6
|
+
export { createHardLintConfig, PRESETS, SEVERITY } from './config.js';
|
|
6
7
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAE,oBAAoB,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/preset.d.ts
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { Rule } from 'eslint';
|
|
2
|
+
import tsparser from '@typescript-eslint/parser';
|
|
3
|
+
declare const hardlintConfig: ({
|
|
4
|
+
readonly rules: Readonly<import("eslint").Linter.RulesRecord>;
|
|
5
|
+
} | {
|
|
6
|
+
ignores: string[];
|
|
7
|
+
files?: undefined;
|
|
8
|
+
plugins?: undefined;
|
|
9
|
+
languageOptions?: undefined;
|
|
10
|
+
rules?: undefined;
|
|
11
|
+
} | {
|
|
12
|
+
files: string[];
|
|
13
|
+
plugins: {
|
|
14
|
+
hardlint: {
|
|
15
|
+
rules: {
|
|
16
|
+
'no-comments': {
|
|
17
|
+
meta: {
|
|
18
|
+
type: string;
|
|
19
|
+
docs: {
|
|
20
|
+
description: string;
|
|
21
|
+
};
|
|
22
|
+
schema: never[];
|
|
23
|
+
messages: {
|
|
24
|
+
noComments: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
create(context: Rule.RuleContext): {
|
|
28
|
+
Program(): void;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
languageOptions: {
|
|
35
|
+
parser: typeof tsparser;
|
|
36
|
+
globals: {
|
|
37
|
+
module: string;
|
|
38
|
+
require: string;
|
|
39
|
+
};
|
|
40
|
+
parserOptions: {
|
|
41
|
+
ecmaVersion: string;
|
|
42
|
+
sourceType: string;
|
|
43
|
+
ecmaFeatures: {
|
|
44
|
+
jsx: boolean;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
rules: {
|
|
49
|
+
'@typescript-eslint/no-explicit-any': string;
|
|
50
|
+
'@typescript-eslint/no-unused-vars': (string | {
|
|
51
|
+
argsIgnorePattern: string;
|
|
52
|
+
varsIgnorePattern: string;
|
|
53
|
+
})[];
|
|
54
|
+
'no-console': string;
|
|
55
|
+
'no-inline-comments': string;
|
|
56
|
+
'no-warning-comments': (string | {
|
|
57
|
+
terms: string[];
|
|
58
|
+
location: string;
|
|
59
|
+
})[];
|
|
60
|
+
'hardlint/no-comments': string;
|
|
61
|
+
'no-var': string;
|
|
62
|
+
'prefer-const': string;
|
|
63
|
+
'prefer-arrow-callback': string;
|
|
64
|
+
'no-nested-ternary': string;
|
|
65
|
+
complexity: (string | number)[];
|
|
66
|
+
'max-depth': (string | number)[];
|
|
67
|
+
'max-nested-callbacks': (string | number)[];
|
|
68
|
+
'no-eval': string;
|
|
69
|
+
'no-implied-eval': string;
|
|
70
|
+
'no-new-func': string;
|
|
71
|
+
'no-script-url': string;
|
|
72
|
+
'sort-imports': (string | {
|
|
73
|
+
ignoreCase: boolean;
|
|
74
|
+
ignoreMemberSort: boolean;
|
|
75
|
+
})[];
|
|
76
|
+
};
|
|
77
|
+
ignores?: undefined;
|
|
78
|
+
})[];
|
|
79
|
+
export default hardlintConfig;
|
|
80
|
+
//# sourceMappingURL=preset.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preset.d.ts","sourceRoot":"","sources":["../src/preset.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,QAAQ,MAAM,2BAA2B,CAAC;AA8DjD,QAAA,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;oCA/CE,IAAI,CAAC,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA8GrC,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
package/dist/preset.js
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import js from '@eslint/js';
|
|
2
|
+
import tsparser from '@typescript-eslint/parser';
|
|
3
|
+
const hardlintPlugin = {
|
|
4
|
+
rules: {
|
|
5
|
+
'no-comments': {
|
|
6
|
+
meta: {
|
|
7
|
+
type: 'problem',
|
|
8
|
+
docs: {
|
|
9
|
+
description: 'Disallow comments except ESLint directives'
|
|
10
|
+
},
|
|
11
|
+
schema: [],
|
|
12
|
+
messages: {
|
|
13
|
+
noComments: 'Comments are not allowed.'
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
create(context) {
|
|
17
|
+
const directivePattern = /^eslint-(disable|enable|disable-next-line|disable-line)(\s|$)/;
|
|
18
|
+
return {
|
|
19
|
+
Program() {
|
|
20
|
+
const sourceCode = context.getSourceCode();
|
|
21
|
+
const comments = sourceCode.getAllComments();
|
|
22
|
+
comments.forEach((comment) => {
|
|
23
|
+
const value = comment.value.trim();
|
|
24
|
+
// Only allow ESLint directives
|
|
25
|
+
if (directivePattern.test(value)) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const reportLoc = comment.loc ??
|
|
29
|
+
{
|
|
30
|
+
start: { line: 1, column: 0 },
|
|
31
|
+
end: { line: 1, column: 0 }
|
|
32
|
+
};
|
|
33
|
+
context.report({
|
|
34
|
+
loc: reportLoc,
|
|
35
|
+
messageId: 'noComments'
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
const hardlintConfig = [
|
|
45
|
+
{
|
|
46
|
+
ignores: ['node_modules/', 'dist/', '.next/', 'coverage/', 'examples/', 'scripts/']
|
|
47
|
+
},
|
|
48
|
+
js.configs.recommended,
|
|
49
|
+
{
|
|
50
|
+
files: ['**/*.{ts,tsx,js,jsx}'],
|
|
51
|
+
plugins: {
|
|
52
|
+
hardlint: hardlintPlugin
|
|
53
|
+
},
|
|
54
|
+
languageOptions: {
|
|
55
|
+
parser: tsparser,
|
|
56
|
+
globals: {
|
|
57
|
+
module: 'readonly',
|
|
58
|
+
require: 'readonly'
|
|
59
|
+
},
|
|
60
|
+
parserOptions: {
|
|
61
|
+
ecmaVersion: 'latest',
|
|
62
|
+
sourceType: 'module',
|
|
63
|
+
ecmaFeatures: {
|
|
64
|
+
jsx: true
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
rules: {
|
|
69
|
+
'@typescript-eslint/no-explicit-any': 'error',
|
|
70
|
+
'@typescript-eslint/no-unused-vars': [
|
|
71
|
+
'error',
|
|
72
|
+
{
|
|
73
|
+
argsIgnorePattern: '^_',
|
|
74
|
+
varsIgnorePattern: '^_'
|
|
75
|
+
}
|
|
76
|
+
],
|
|
77
|
+
'no-console': 'error',
|
|
78
|
+
'no-inline-comments': 'error',
|
|
79
|
+
'no-warning-comments': [
|
|
80
|
+
'error',
|
|
81
|
+
{
|
|
82
|
+
terms: ['todo', 'fixme', 'hack', 'xxx', 'note', 'debug', 'review'],
|
|
83
|
+
location: 'anywhere'
|
|
84
|
+
}
|
|
85
|
+
],
|
|
86
|
+
'hardlint/no-comments': 'error',
|
|
87
|
+
'no-var': 'error',
|
|
88
|
+
'prefer-const': 'error',
|
|
89
|
+
'prefer-arrow-callback': 'error',
|
|
90
|
+
'no-nested-ternary': 'error',
|
|
91
|
+
complexity: ['error', 10],
|
|
92
|
+
'max-depth': ['error', 3],
|
|
93
|
+
'max-nested-callbacks': ['error', 3],
|
|
94
|
+
'no-eval': 'error',
|
|
95
|
+
'no-implied-eval': 'error',
|
|
96
|
+
'no-new-func': 'error',
|
|
97
|
+
'no-script-url': 'error',
|
|
98
|
+
'sort-imports': [
|
|
99
|
+
'error',
|
|
100
|
+
{
|
|
101
|
+
ignoreCase: true,
|
|
102
|
+
ignoreMemberSort: true
|
|
103
|
+
}
|
|
104
|
+
]
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
];
|
|
108
|
+
export default hardlintConfig;
|
|
109
|
+
//# sourceMappingURL=preset.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preset.js","sourceRoot":"","sources":["../src/preset.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,OAAO,QAAQ,MAAM,2BAA2B,CAAC;AAEjD,MAAM,cAAc,GAAG;IACrB,KAAK,EAAE;QACL,aAAa,EAAE;YACb,IAAI,EAAE;gBACJ,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE;oBACJ,WAAW,EAAE,4CAA4C;iBAC1D;gBACD,MAAM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E,UAAU;gBAClB,OAAO,EAAE,UAAU;aACpB;YACD,aAAa,EAAE;gBACb,WAAW,EAAE,QAAQ;gBACrB,UAAU,EAAE,QAAQ;gBACpB,YAAY,EAAE;oBACZ,GAAG,EAAE,IAAI;iBACV;aACF;SACF;QACD,KAAK,EAAE;YACL,oCAAoC,EAAE,OAAO;YAC7C,mCAAmC,EAAE;gBACnC,OAAO;gBACP;oBACE,iBAAiB,EAAE,IAAI;oBACvB,iBAAiB,EAAE,IAAI;iBACxB;aACF;YACD,YAAY,EAAE,OAAO;YACrB,oBAAoB,EAAE,OAAO;YAC7B,qBAAqB,EAAE;gBACrB,OAAO;gBACP;oBACE,KAAK,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC;oBAClE,QAAQ,EAAE,UAAU;iBACrB;aACF;YACD,sBAAsB,EAAE,OAAO;YAC/B,QAAQ,EAAE,OAAO;YACjB,cAAc,EAAE,OAAO;YACvB,uBAAuB,EAAE,OAAO;YAChC,mBAAmB,EAAE,OAAO;YAC5B,UAAU,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC;YACzB,WAAW,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;YACzB,sBAAsB,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;YACpC,SAAS,EAAE,OAAO;YAClB,iBAAiB,EAAE,OAAO;YAC1B,aAAa,EAAE,OAAO;YACtB,eAAe,EAAE,OAAO;YACxB,cAAc,EAAE;gBACd,OAAO;gBACP;oBACE,UAAU,EAAE,IAAI;oBAChB,gBAAgB,EAAE,IAAI;iBACvB;aACF;SACF;KACF;CACF,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hard-lint",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Configuração rigorosa de ESLint para projetos TypeScript",
|
|
5
|
+
"type": "module",
|
|
5
6
|
"main": "dist/index.js",
|
|
6
7
|
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./eslint.config.mjs": "./eslint.config.mjs"
|
|
15
|
+
},
|
|
7
16
|
"files": [
|
|
8
17
|
"dist",
|
|
9
18
|
"eslint.config.mjs"
|
|
@@ -14,6 +23,7 @@
|
|
|
14
23
|
"lint": "eslint .",
|
|
15
24
|
"type-check": "tsc --noEmit",
|
|
16
25
|
"validate-e2e": "node scripts/validate-e2e-selectors.js",
|
|
26
|
+
"validate-jsdoc": "node scripts/validate-no-jsdoc.js",
|
|
17
27
|
"prepare": "npm run build && husky install"
|
|
18
28
|
},
|
|
19
29
|
"keywords": [
|