eslint-plugin-traceability 1.5.1 → 1.6.1
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 +2 -0
- package/lib/src/rules/helpers/require-story-helpers.d.ts +4 -0
- package/lib/src/rules/helpers/require-story-helpers.js +6 -0
- package/lib/src/rules/require-branch-annotation.d.ts +11 -4
- package/lib/src/rules/require-branch-annotation.js +18 -4
- package/lib/src/rules/require-req-annotation.d.ts +9 -4
- package/lib/src/rules/require-req-annotation.js +69 -21
- package/lib/src/rules/require-story-annotation.d.ts +6 -0
- package/lib/src/rules/require-story-annotation.js +15 -1
- package/lib/src/rules/valid-annotation-format.js +154 -6
- package/lib/src/rules/valid-req-reference.js +30 -51
- package/lib/src/utils/annotation-checker.d.ts +7 -1
- package/lib/src/utils/annotation-checker.js +51 -8
- package/lib/tests/rules/auto-fix-behavior-008.test.d.ts +1 -0
- package/lib/tests/rules/auto-fix-behavior-008.test.js +160 -0
- package/lib/tests/rules/error-reporting.test.js +1 -0
- package/lib/tests/rules/require-req-annotation.test.js +139 -4
- package/lib/tests/rules/require-story-annotation.test.js +7 -0
- package/lib/tests/rules/valid-annotation-format.test.js +2 -0
- package/package.json +3 -4
|
@@ -69,6 +69,7 @@ declare function tsDecl(): void;`,
|
|
|
69
69
|
{
|
|
70
70
|
name: "[REQ-ANNOTATION-REQUIRED] missing @story annotation on function",
|
|
71
71
|
code: `function bar() {}`,
|
|
72
|
+
output: `/** @story docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md */\nfunction bar() {}`,
|
|
72
73
|
errors: [
|
|
73
74
|
{
|
|
74
75
|
messageId: "missingStory",
|
|
@@ -84,6 +85,7 @@ declare function tsDecl(): void;`,
|
|
|
84
85
|
{
|
|
85
86
|
name: "[REQ-ANNOTATION-REQUIRED] missing @story on function expression",
|
|
86
87
|
code: `const fnExpr = function() {};`,
|
|
88
|
+
output: `/** @story docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md */\nconst fnExpr = function() {};`,
|
|
87
89
|
errors: [
|
|
88
90
|
{
|
|
89
91
|
messageId: "missingStory",
|
|
@@ -99,6 +101,7 @@ declare function tsDecl(): void;`,
|
|
|
99
101
|
{
|
|
100
102
|
name: "[REQ-ANNOTATION-REQUIRED] missing @story on class method",
|
|
101
103
|
code: `class C {\n method() {}\n}`,
|
|
104
|
+
output: `class C {\n /** @story docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md */\n method() {}\n}`,
|
|
102
105
|
errors: [
|
|
103
106
|
{
|
|
104
107
|
messageId: "missingStory",
|
|
@@ -114,6 +117,7 @@ declare function tsDecl(): void;`,
|
|
|
114
117
|
{
|
|
115
118
|
name: "[REQ-ANNOTATION-REQUIRED] missing @story on TS declare function",
|
|
116
119
|
code: `declare function tsDecl(): void;`,
|
|
120
|
+
output: `/** @story docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md */\ndeclare function tsDecl(): void;`,
|
|
117
121
|
languageOptions: {
|
|
118
122
|
parser: require("@typescript-eslint/parser"),
|
|
119
123
|
parserOptions: { ecmaVersion: 2020, sourceType: "module" },
|
|
@@ -133,6 +137,7 @@ declare function tsDecl(): void;`,
|
|
|
133
137
|
{
|
|
134
138
|
name: "[REQ-ANNOTATION-REQUIRED] missing @story on TS method signature",
|
|
135
139
|
code: `interface D {\n method(): void;\n}`,
|
|
140
|
+
output: `/** @story docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md */\ninterface D {\n method(): void;\n}`,
|
|
136
141
|
languageOptions: {
|
|
137
142
|
parser: require("@typescript-eslint/parser"),
|
|
138
143
|
parserOptions: { ecmaVersion: 2020, sourceType: "module" },
|
|
@@ -173,6 +178,7 @@ declare function tsDecl(): void;`,
|
|
|
173
178
|
{
|
|
174
179
|
name: "[exportPriority] exported function missing @story annotation",
|
|
175
180
|
code: `export function exportedMissing() {}`,
|
|
181
|
+
output: `/** @story docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md */\nexport function exportedMissing() {}`,
|
|
176
182
|
options: [{ exportPriority: "exported" }],
|
|
177
183
|
errors: [
|
|
178
184
|
{
|
|
@@ -200,6 +206,7 @@ declare function tsDecl(): void;`,
|
|
|
200
206
|
{
|
|
201
207
|
name: "[scope] function declaration missing annotation when scope is FunctionDeclaration",
|
|
202
208
|
code: `function onlyDecl() {}`,
|
|
209
|
+
output: `/** @story docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md */\nfunction onlyDecl() {}`,
|
|
203
210
|
options: [{ scope: ["FunctionDeclaration"] }],
|
|
204
211
|
errors: [
|
|
205
212
|
{
|
|
@@ -69,6 +69,7 @@ describe("Valid Annotation Format Rule (Story 005.0-DEV-ANNOTATION-VALIDATION)",
|
|
|
69
69
|
{
|
|
70
70
|
name: "[REQ-PATH-FORMAT] invalid story file extension",
|
|
71
71
|
code: `// @story docs/stories/005.0-DEV-ANNOTATION-VALIDATION.story`,
|
|
72
|
+
output: `// @story docs/stories/005.0-DEV-ANNOTATION-VALIDATION.story.md`,
|
|
72
73
|
errors: [
|
|
73
74
|
{
|
|
74
75
|
messageId: "invalidStoryFormat",
|
|
@@ -81,6 +82,7 @@ describe("Valid Annotation Format Rule (Story 005.0-DEV-ANNOTATION-VALIDATION)",
|
|
|
81
82
|
{
|
|
82
83
|
name: "[REQ-PATH-FORMAT] missing extension in story path",
|
|
83
84
|
code: `// @story docs/stories/005.0-DEV-ANNOTATION-VALIDATION`,
|
|
85
|
+
output: `// @story docs/stories/005.0-DEV-ANNOTATION-VALIDATION.story.md`,
|
|
84
86
|
errors: [
|
|
85
87
|
{
|
|
86
88
|
messageId: "invalidStoryFormat",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-traceability",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.1",
|
|
4
4
|
"description": "A customizable ESLint plugin that enforces traceability annotations in your code, ensuring each implementation is linked to its requirement or test case.",
|
|
5
5
|
"main": "lib/src/index.js",
|
|
6
6
|
"types": "lib/src/index.d.ts",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"lint": "eslint --config eslint.config.js \"src/**/*.{js,ts}\" \"tests/**/*.{js,ts}\" --max-warnings=0",
|
|
23
23
|
"test": "jest --ci --bail",
|
|
24
24
|
"ci-verify": "npm run type-check && npm run lint && npm run format:check && npm run duplication && npm run check:traceability && npm test && npm run audit:ci && npm run safety:deps",
|
|
25
|
-
"ci-verify:full": "npm run check:traceability && npm run safety:deps && npm run audit:ci && npm run build && npm run type-check && npm run lint-plugin-check && npm run lint -- --max-warnings=0 && npm run duplication && npm run test -- --coverage && npm run format:check && npm audit --
|
|
25
|
+
"ci-verify:full": "npm run check:traceability && npm run safety:deps && npm run audit:ci && npm run build && npm run type-check && npm run lint-plugin-check && npm run lint -- --max-warnings=0 && npm run duplication && npm run test -- --coverage && npm run format:check && npm audit --omit=dev --audit-level=high && npm run audit:dev-high",
|
|
26
26
|
"ci-verify:fast": "npm run type-check && npm run check:traceability && npm run duplication && jest --ci --bail --passWithNoTests --testPathPatterns 'tests/(unit|fast)'",
|
|
27
27
|
"format": "prettier --write .",
|
|
28
28
|
"format:check": "prettier --check \"src/**/*.ts\" \"tests/**/*.ts\"",
|
|
@@ -30,8 +30,7 @@
|
|
|
30
30
|
"audit:dev-high": "node scripts/generate-dev-deps-audit.js",
|
|
31
31
|
"safety:deps": "node scripts/ci-safety-deps.js",
|
|
32
32
|
"audit:ci": "node scripts/ci-audit.js",
|
|
33
|
-
"smoke-test": "./scripts/smoke-test.sh"
|
|
34
|
-
"prepare": "husky install"
|
|
33
|
+
"smoke-test": "./scripts/smoke-test.sh"
|
|
35
34
|
},
|
|
36
35
|
"lint-staged": {
|
|
37
36
|
"src/**/*.{js,jsx,ts,tsx,json,md}": [
|