@dvukovic/style-guide 0.10.3 → 0.12.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/scripts/changelog-report.types.d.ts +28 -0
- package/dist/src/eslint/configs/typescript.d.ts +13 -0
- package/dist/src/eslint/rules/document-todos/document-todos.d.ts +24 -0
- package/dist/src/prettier/configs/core.test.d.ts +1 -0
- package/dist/src/stylelint/configs/core.test.d.ts +1 -0
- package/package.json +24 -22
- package/src/cspell/base.txt +1 -0
- package/src/eslint/configs/typescript.js +1 -0
- package/src/eslint/plugins/dvukovic.js +3 -0
- package/src/eslint/plugins/jest.js +5 -0
- package/src/eslint/plugins/playwright.js +1 -0
- package/src/eslint/plugins/rimac.js +0 -1
- package/src/eslint/plugins/vitest.js +1 -0
- package/src/eslint/rules/document-todos/document-todos.js +63 -0
- package/src/eslint/rules/document-todos/document-todos.test.js +174 -0
- package/dist/eslint/configs/typescript.d.ts +0 -24
- /package/dist/{eslint/configs/aws.test.d.ts → scripts/changelog-report.d.ts} +0 -0
- /package/dist/{cli → src/cli}/generators/cspell.d.ts +0 -0
- /package/dist/{cli → src/cli}/generators/eslint.d.ts +0 -0
- /package/dist/{cli → src/cli}/generators/knip.d.ts +0 -0
- /package/dist/{cli → src/cli}/generators/prettier.d.ts +0 -0
- /package/dist/{cli → src/cli}/generators/scripts.d.ts +0 -0
- /package/dist/{cli → src/cli}/generators/stylelint.d.ts +0 -0
- /package/dist/{cli → src/cli}/index.d.ts +0 -0
- /package/dist/{cli → src/cli}/init.d.ts +0 -0
- /package/dist/{cli → src/cli}/prompts.d.ts +0 -0
- /package/dist/{cspell → src/cspell}/configs/core.d.ts +0 -0
- /package/dist/{cspell → src/cspell}/index.d.ts +0 -0
- /package/dist/{eslint → src/eslint}/configs/aws.d.ts +0 -0
- /package/dist/{eslint/configs/core.test.d.ts → src/eslint/configs/aws.test.d.ts} +0 -0
- /package/dist/{eslint → src/eslint}/configs/core.d.ts +0 -0
- /package/dist/{prettier → src/eslint}/configs/core.test.d.ts +0 -0
- /package/dist/{eslint → src/eslint}/configs/jest.d.ts +0 -0
- /package/dist/{eslint → src/eslint}/configs/jest.test.d.ts +0 -0
- /package/dist/{eslint → src/eslint}/configs/mobx.d.ts +0 -0
- /package/dist/{eslint → src/eslint}/configs/mobx.test.d.ts +0 -0
- /package/dist/{eslint → src/eslint}/configs/next.d.ts +0 -0
- /package/dist/{eslint → src/eslint}/configs/next.test.d.ts +0 -0
- /package/dist/{eslint → src/eslint}/configs/node.d.ts +0 -0
- /package/dist/{eslint → src/eslint}/configs/node.test.d.ts +0 -0
- /package/dist/{eslint → src/eslint}/configs/package-json.d.ts +0 -0
- /package/dist/{eslint → src/eslint}/configs/package-json.test.d.ts +0 -0
- /package/dist/{eslint → src/eslint}/configs/playwright.d.ts +0 -0
- /package/dist/{eslint → src/eslint}/configs/playwright.test.d.ts +0 -0
- /package/dist/{eslint → src/eslint}/configs/react.d.ts +0 -0
- /package/dist/{eslint → src/eslint}/configs/react.test.d.ts +0 -0
- /package/dist/{eslint → src/eslint}/configs/storybook.d.ts +0 -0
- /package/dist/{eslint → src/eslint}/configs/storybook.test.d.ts +0 -0
- /package/dist/{eslint → src/eslint}/configs/typescript-strict.d.ts +0 -0
- /package/dist/{eslint → src/eslint}/configs/typescript-strict.test.d.ts +0 -0
- /package/dist/{eslint → src/eslint}/configs/typescript.test.d.ts +0 -0
- /package/dist/{eslint → src/eslint}/configs/vitest.d.ts +0 -0
- /package/dist/{eslint → src/eslint}/configs/vitest.test.d.ts +0 -0
- /package/dist/{eslint → src/eslint}/index.d.ts +0 -0
- /package/dist/{eslint → src/eslint}/plugins/baseline.d.ts +0 -0
- /package/dist/{eslint → src/eslint}/plugins/dvukovic.d.ts +0 -0
- /package/dist/{eslint → src/eslint}/plugins/eslint-comments.d.ts +0 -0
- /package/dist/{eslint → src/eslint}/plugins/eslint.d.ts +0 -0
- /package/dist/{eslint → src/eslint}/plugins/eslint.test.d.ts +0 -0
- /package/dist/{eslint → src/eslint}/plugins/import-x.d.ts +0 -0
- /package/dist/{eslint → src/eslint}/plugins/jest.d.ts +0 -0
- /package/dist/{eslint → src/eslint}/plugins/mobx.d.ts +0 -0
- /package/dist/{eslint → src/eslint}/plugins/n.d.ts +0 -0
- /package/dist/{eslint → src/eslint}/plugins/next.d.ts +0 -0
- /package/dist/{eslint → src/eslint}/plugins/package-json.d.ts +0 -0
- /package/dist/{eslint → src/eslint}/plugins/playwright.d.ts +0 -0
- /package/dist/{eslint → src/eslint}/plugins/promise.d.ts +0 -0
- /package/dist/{eslint → src/eslint}/plugins/react-hooks.d.ts +0 -0
- /package/dist/{eslint → src/eslint}/plugins/react.d.ts +0 -0
- /package/dist/{eslint → src/eslint}/plugins/rimac.d.ts +0 -0
- /package/dist/{eslint → src/eslint}/plugins/security-node.d.ts +0 -0
- /package/dist/{eslint → src/eslint}/plugins/simple-import-sort.d.ts +0 -0
- /package/dist/{eslint → src/eslint}/plugins/sonarjs-aws.d.ts +0 -0
- /package/dist/{eslint → src/eslint}/plugins/sonarjs.d.ts +0 -0
- /package/dist/{eslint → src/eslint}/plugins/sort-destructure-keys.d.ts +0 -0
- /package/dist/{eslint → src/eslint}/plugins/sort-keys-fix.d.ts +0 -0
- /package/dist/{eslint → src/eslint}/plugins/storybook.d.ts +0 -0
- /package/dist/{eslint → src/eslint}/plugins/stylistic.d.ts +0 -0
- /package/dist/{eslint → src/eslint}/plugins/typescript-eslint.d.ts +0 -0
- /package/dist/{eslint → src/eslint}/plugins/typescript-sort-keys.d.ts +0 -0
- /package/dist/{eslint → src/eslint}/plugins/unicorn.d.ts +0 -0
- /package/dist/{eslint → src/eslint}/plugins/unused-imports.d.ts +0 -0
- /package/dist/{eslint → src/eslint}/plugins/vitest.d.ts +0 -0
- /package/dist/{eslint/rules/no-commented-out-code/no-commented-out-code.test.d.ts → src/eslint/rules/document-todos/document-todos.test.d.ts} +0 -0
- /package/dist/{eslint → src/eslint}/rules/no-commented-out-code/no-commented-out-code.d.ts +0 -0
- /package/dist/{eslint/rules/no-restricted-dependencies/no-restricted-dependencies.test.d.ts → src/eslint/rules/no-commented-out-code/no-commented-out-code.test.d.ts} +0 -0
- /package/dist/{eslint → src/eslint}/rules/no-commented-out-code/no-commented-out-code.utils.d.ts +0 -0
- /package/dist/{eslint → src/eslint}/rules/no-restricted-dependencies/no-restricted-dependencies.d.ts +0 -0
- /package/dist/{eslint/rules/no-t/no-t.test.d.ts → src/eslint/rules/no-restricted-dependencies/no-restricted-dependencies.test.d.ts} +0 -0
- /package/dist/{eslint → src/eslint}/rules/no-t/no-t.d.ts +0 -0
- /package/dist/{eslint/rules/require-properties/require-properties.test.d.ts → src/eslint/rules/no-t/no-t.test.d.ts} +0 -0
- /package/dist/{eslint → src/eslint}/rules/require-properties/require-properties.d.ts +0 -0
- /package/dist/{eslint/rules/valid-engines-node/valid-engines-node.test.d.ts → src/eslint/rules/require-properties/require-properties.test.d.ts} +0 -0
- /package/dist/{eslint → src/eslint}/rules/valid-engines-node/valid-engines-node.d.ts +0 -0
- /package/dist/{stylelint/configs/core.test.d.ts → src/eslint/rules/valid-engines-node/valid-engines-node.test.d.ts} +0 -0
- /package/dist/{knip → src/knip}/configs/core.d.ts +0 -0
- /package/dist/{knip → src/knip}/index.d.ts +0 -0
- /package/dist/{prettier → src/prettier}/configs/core.d.ts +0 -0
- /package/dist/{prettier → src/prettier}/index.d.ts +0 -0
- /package/dist/{prettier → src/prettier}/plugins/embed.d.ts +0 -0
- /package/dist/{prettier → src/prettier}/plugins/prettier.d.ts +0 -0
- /package/dist/{prettier → src/prettier}/plugins/sql.d.ts +0 -0
- /package/dist/{stylelint → src/stylelint}/configs/core.d.ts +0 -0
- /package/dist/{stylelint → src/stylelint}/index.d.ts +0 -0
- /package/dist/{stylelint → src/stylelint}/plugins/no-unused-selectors.d.ts +0 -0
- /package/dist/{stylelint → src/stylelint}/plugins/order.d.ts +0 -0
- /package/dist/{stylelint → src/stylelint}/plugins/stylelint.d.ts +0 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export type OutdatedPackageType = {
|
|
2
|
+
current: string;
|
|
3
|
+
latest: string;
|
|
4
|
+
name: string;
|
|
5
|
+
};
|
|
6
|
+
export type NpmRegistryResponseType = {
|
|
7
|
+
repository?: {
|
|
8
|
+
url?: string;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export type GitHubReleaseType = {
|
|
12
|
+
body: string;
|
|
13
|
+
name: string;
|
|
14
|
+
published_at: string;
|
|
15
|
+
tag_name: string;
|
|
16
|
+
};
|
|
17
|
+
export type PackageChangelogType = {
|
|
18
|
+
changelog: string;
|
|
19
|
+
current: string;
|
|
20
|
+
latest: string;
|
|
21
|
+
name: string;
|
|
22
|
+
};
|
|
23
|
+
export type NpmOutdatedEntryType = {
|
|
24
|
+
current: string;
|
|
25
|
+
latest: string;
|
|
26
|
+
wanted: string;
|
|
27
|
+
};
|
|
28
|
+
export type NpmOutdatedOutputType = Record<string, NpmOutdatedEntryType>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript ESLint configuration with parser setup and rules
|
|
3
|
+
*
|
|
4
|
+
* @param {import("@eslint/config-helpers").ConfigWithExtends & { onlyFiles?: string[] }} [config]
|
|
5
|
+
* - Additional config
|
|
6
|
+
*
|
|
7
|
+
* @returns {import("@eslint/config-helpers").ConfigWithExtends} ESLint config
|
|
8
|
+
*/
|
|
9
|
+
export function typescript(config?: import("@eslint/config-helpers").ConfigWithExtends & {
|
|
10
|
+
onlyFiles?: string[];
|
|
11
|
+
}): import("@eslint/config-helpers").ConfigWithExtends;
|
|
12
|
+
/** @type {import("eslint").Linter.Config[]} */
|
|
13
|
+
export const typescriptConfig: import("eslint").Linter.Config[];
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export namespace documentTodos {
|
|
2
|
+
function create(context: any): {
|
|
3
|
+
Program(): void;
|
|
4
|
+
};
|
|
5
|
+
namespace meta {
|
|
6
|
+
namespace docs {
|
|
7
|
+
let description: string;
|
|
8
|
+
}
|
|
9
|
+
namespace messages {
|
|
10
|
+
let _default: string;
|
|
11
|
+
export { _default as default };
|
|
12
|
+
}
|
|
13
|
+
let schema: {
|
|
14
|
+
additionalProperties: boolean;
|
|
15
|
+
properties: {
|
|
16
|
+
url: {
|
|
17
|
+
type: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
type: string;
|
|
21
|
+
}[];
|
|
22
|
+
let type: string;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dvukovic/style-guide",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "My own style guide",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -58,21 +58,21 @@
|
|
|
58
58
|
"test": "vitest run"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@clack/prompts": "0.
|
|
62
|
-
"@eslint-community/eslint-plugin-eslint-comments": "4.
|
|
63
|
-
"@eslint/config-helpers": "0.
|
|
64
|
-
"@next/eslint-plugin-next": "16.1.
|
|
61
|
+
"@clack/prompts": "0.11.0",
|
|
62
|
+
"@eslint-community/eslint-plugin-eslint-comments": "4.6.0",
|
|
63
|
+
"@eslint/config-helpers": "0.5.1",
|
|
64
|
+
"@next/eslint-plugin-next": "16.1.4",
|
|
65
65
|
"@rimac-technology/eslint-plugin": "1.5.0",
|
|
66
|
-
"@stylistic/eslint-plugin": "5.
|
|
67
|
-
"@typescript-eslint/parser": "8.
|
|
68
|
-
"@vitest/eslint-plugin": "1.
|
|
66
|
+
"@stylistic/eslint-plugin": "5.7.1",
|
|
67
|
+
"@typescript-eslint/parser": "8.53.1",
|
|
68
|
+
"@vitest/eslint-plugin": "1.6.6",
|
|
69
69
|
"eslint-plugin-baseline-js": "0.4.2",
|
|
70
70
|
"eslint-plugin-import-x": "4.16.1",
|
|
71
|
-
"eslint-plugin-jest": "29.
|
|
71
|
+
"eslint-plugin-jest": "29.12.1",
|
|
72
72
|
"eslint-plugin-mobx": "0.0.13",
|
|
73
|
-
"eslint-plugin-n": "17.23.
|
|
74
|
-
"eslint-plugin-package-json": "0.88.
|
|
75
|
-
"eslint-plugin-playwright": "2.
|
|
73
|
+
"eslint-plugin-n": "17.23.2",
|
|
74
|
+
"eslint-plugin-package-json": "0.88.2",
|
|
75
|
+
"eslint-plugin-playwright": "2.5.0",
|
|
76
76
|
"eslint-plugin-promise": "7.2.1",
|
|
77
77
|
"eslint-plugin-react": "7.37.5",
|
|
78
78
|
"eslint-plugin-react-hooks": "7.0.1",
|
|
@@ -81,35 +81,37 @@
|
|
|
81
81
|
"eslint-plugin-sonarjs": "3.0.5",
|
|
82
82
|
"eslint-plugin-sort-destructure-keys": "2.0.0",
|
|
83
83
|
"eslint-plugin-sort-keys-fix": "1.1.2",
|
|
84
|
-
"eslint-plugin-storybook": "10.
|
|
84
|
+
"eslint-plugin-storybook": "10.2.0",
|
|
85
85
|
"eslint-plugin-typescript-sort-keys": "3.3.0",
|
|
86
86
|
"eslint-plugin-unicorn": "62.0.0",
|
|
87
87
|
"eslint-plugin-unused-imports": "4.3.0",
|
|
88
|
-
"globals": "
|
|
88
|
+
"globals": "17.1.0",
|
|
89
89
|
"jsonc-eslint-parser": "2.4.2",
|
|
90
90
|
"prettier-plugin-embed": "0.5.1",
|
|
91
91
|
"prettier-plugin-jsdoc": "1.8.0",
|
|
92
|
-
"prettier-plugin-packagejson": "
|
|
92
|
+
"prettier-plugin-packagejson": "3.0.0",
|
|
93
93
|
"prettier-plugin-prisma": "5.0.0",
|
|
94
94
|
"prettier-plugin-sh": "0.18.0",
|
|
95
95
|
"prettier-plugin-sql": "0.19.2",
|
|
96
96
|
"prettier-plugin-tailwindcss": "0.7.2",
|
|
97
97
|
"prettier-plugin-toml": "2.0.6",
|
|
98
98
|
"stylelint-no-unused-selectors": "1.0.40",
|
|
99
|
-
"stylelint-order": "7.0.
|
|
100
|
-
"typescript-eslint": "8.
|
|
99
|
+
"stylelint-order": "7.0.1",
|
|
100
|
+
"typescript-eslint": "8.53.1"
|
|
101
101
|
},
|
|
102
102
|
"devDependencies": {
|
|
103
103
|
"@release-it/conventional-changelog": "10.0.4",
|
|
104
|
-
"@types/node": "24.10.
|
|
105
|
-
"
|
|
104
|
+
"@types/node": "24.10.9",
|
|
105
|
+
"@types/semver": "7.7.1",
|
|
106
|
+
"cspell": "9.6.0",
|
|
106
107
|
"eslint": "9.39.2",
|
|
107
108
|
"knip": "5.82.1",
|
|
108
|
-
"prettier": "3.
|
|
109
|
-
"release-it": "19.
|
|
109
|
+
"prettier": "3.8.1",
|
|
110
|
+
"release-it": "19.2.4",
|
|
111
|
+
"semver": "7.7.3",
|
|
110
112
|
"stylelint": "16.26.1",
|
|
111
113
|
"typescript": "5.9.3",
|
|
112
|
-
"vitest": "4.0.
|
|
114
|
+
"vitest": "4.0.18"
|
|
113
115
|
},
|
|
114
116
|
"peerDependencies": {
|
|
115
117
|
"cspell": "9",
|
package/src/cspell/base.txt
CHANGED
|
@@ -3,6 +3,7 @@ import tseslint from "typescript-eslint"
|
|
|
3
3
|
import { typescriptEslint } from "../plugins/typescript-eslint.js"
|
|
4
4
|
import { typescriptSortKeys } from "../plugins/typescript-sort-keys.js"
|
|
5
5
|
|
|
6
|
+
/** @type {import("eslint").Linter.Config[]} */
|
|
6
7
|
export const typescriptConfig = [
|
|
7
8
|
{
|
|
8
9
|
files: ["**/*.js", "**/*.ts", "**/*.tsx", "**/*.cjs"],
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { documentTodos } from "../rules/document-todos/document-todos.js"
|
|
1
2
|
import { noCommentedOutCode } from "../rules/no-commented-out-code/no-commented-out-code.js"
|
|
2
3
|
import { noT } from "../rules/no-t/no-t.js"
|
|
3
4
|
|
|
@@ -6,12 +7,14 @@ export const dvukovic = {
|
|
|
6
7
|
plugins: {
|
|
7
8
|
dvukovic: {
|
|
8
9
|
rules: {
|
|
10
|
+
"document-todos": documentTodos,
|
|
9
11
|
"no-commented-out-code": noCommentedOutCode,
|
|
10
12
|
"no-t": noT,
|
|
11
13
|
},
|
|
12
14
|
},
|
|
13
15
|
},
|
|
14
16
|
rules: {
|
|
17
|
+
"dvukovic/document-todos": ["error", { url: "http" }],
|
|
15
18
|
"dvukovic/no-commented-out-code": "error",
|
|
16
19
|
"dvukovic/no-t": "error",
|
|
17
20
|
},
|
|
@@ -37,6 +37,7 @@ export const jest = {
|
|
|
37
37
|
"jest/no-disabled-tests": "error",
|
|
38
38
|
"jest/no-done-callback": "error",
|
|
39
39
|
"jest/no-duplicate-hooks": "error",
|
|
40
|
+
"jest/no-error-equal": "error",
|
|
40
41
|
"jest/no-export": "error",
|
|
41
42
|
"jest/no-focused-tests": "error",
|
|
42
43
|
"jest/no-identical-title": "error",
|
|
@@ -46,6 +47,8 @@ export const jest = {
|
|
|
46
47
|
"jest/no-standalone-expect": "error",
|
|
47
48
|
"jest/no-test-prefixes": "error",
|
|
48
49
|
"jest/no-test-return-statement": "error",
|
|
50
|
+
"jest/no-unnecessary-assertion": "error",
|
|
51
|
+
"jest/no-unneeded-async-expect-function": "error",
|
|
49
52
|
"jest/no-untyped-mock-factory": "error",
|
|
50
53
|
"jest/padding-around-after-all-blocks": "error",
|
|
51
54
|
"jest/padding-around-after-each-blocks": "error",
|
|
@@ -64,6 +67,7 @@ export const jest = {
|
|
|
64
67
|
"jest/prefer-jest-mocked": "error",
|
|
65
68
|
"jest/prefer-lowercase-title": ["error", { ignoreTopLevelDescribe: true }],
|
|
66
69
|
"jest/prefer-mock-promise-shorthand": "error",
|
|
70
|
+
"jest/prefer-mock-return-shorthand": "error",
|
|
67
71
|
"jest/prefer-spy-on": "error",
|
|
68
72
|
"jest/prefer-strict-equal": "error",
|
|
69
73
|
"jest/prefer-to-be": "error",
|
|
@@ -78,6 +82,7 @@ export const jest = {
|
|
|
78
82
|
"jest/valid-describe-callback": "error",
|
|
79
83
|
"jest/valid-expect": "error",
|
|
80
84
|
"jest/valid-expect-in-promise": "error",
|
|
85
|
+
"jest/valid-expect-with-promise": "error",
|
|
81
86
|
"jest/valid-mock-module-path": "error",
|
|
82
87
|
"jest/valid-title": "error",
|
|
83
88
|
},
|
|
@@ -6,6 +6,7 @@ export const playwright = {
|
|
|
6
6
|
playwright: plugin,
|
|
7
7
|
},
|
|
8
8
|
rules: {
|
|
9
|
+
"playwright/enforce-consistent-spacing-between-blocks": "error",
|
|
9
10
|
"playwright/expect-expect": "error",
|
|
10
11
|
"playwright/max-expects": ["error", { max: 15 }],
|
|
11
12
|
"playwright/max-nested-describe": ["error", { max: 4 }],
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
export const documentTodos = {
|
|
2
|
+
create(context) {
|
|
3
|
+
const url = context.options[0]?.url
|
|
4
|
+
|
|
5
|
+
if (!url) {
|
|
6
|
+
throw new Error("URL not set for the document-todos rule. Please set the URL.")
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
return {
|
|
10
|
+
Program() {
|
|
11
|
+
const sourceCode = context.sourceCode
|
|
12
|
+
const comments = sourceCode.getAllComments()
|
|
13
|
+
|
|
14
|
+
for (const comment of comments) {
|
|
15
|
+
const isTodo = comment.value.includes("TODO:")
|
|
16
|
+
const isFixme = comment.value.includes("FIXME:")
|
|
17
|
+
const hasLink = comment.value.includes(url.toLowerCase())
|
|
18
|
+
const startsWithTodo = comment.value
|
|
19
|
+
.trimStart()
|
|
20
|
+
.toLowerCase()
|
|
21
|
+
.startsWith("todo")
|
|
22
|
+
const startsWithFixme = comment.value
|
|
23
|
+
.trimStart()
|
|
24
|
+
.toLowerCase()
|
|
25
|
+
.startsWith("fixme")
|
|
26
|
+
|
|
27
|
+
if ((isTodo || isFixme || startsWithFixme || startsWithTodo) && hasLink) {
|
|
28
|
+
continue
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (!isTodo && !isFixme && !startsWithFixme && !startsWithTodo) {
|
|
32
|
+
continue
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
context.report({
|
|
36
|
+
loc: comment.loc,
|
|
37
|
+
messageId: "default",
|
|
38
|
+
})
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
meta: {
|
|
44
|
+
docs: {
|
|
45
|
+
description: "Ensure all TODOs and FIXMEs have an issue link attached to them",
|
|
46
|
+
},
|
|
47
|
+
messages: {
|
|
48
|
+
default: "All TODOs and FIXMEs must have an issue link attached to them",
|
|
49
|
+
},
|
|
50
|
+
schema: [
|
|
51
|
+
{
|
|
52
|
+
additionalProperties: false,
|
|
53
|
+
properties: {
|
|
54
|
+
url: {
|
|
55
|
+
type: "string",
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
type: "object",
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
type: "problem",
|
|
62
|
+
},
|
|
63
|
+
}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { ESLint } from "eslint"
|
|
2
|
+
import tseslint from "typescript-eslint"
|
|
3
|
+
|
|
4
|
+
import { documentTodos } from "./document-todos.js"
|
|
5
|
+
|
|
6
|
+
const createEslint = (url = "http") => {
|
|
7
|
+
return new ESLint({
|
|
8
|
+
overrideConfig: [
|
|
9
|
+
{
|
|
10
|
+
files: ["**/*.ts"],
|
|
11
|
+
languageOptions: {
|
|
12
|
+
parser: tseslint.parser,
|
|
13
|
+
},
|
|
14
|
+
plugins: {
|
|
15
|
+
dvukovic: {
|
|
16
|
+
rules: {
|
|
17
|
+
"document-todos": documentTodos,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
rules: {
|
|
22
|
+
"dvukovic/document-todos": ["error", { url }],
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
overrideConfigFile: true,
|
|
27
|
+
})
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
describe("dvukovic/document-todos", () => {
|
|
31
|
+
test("reports TODO without URL", async () => {
|
|
32
|
+
const eslint = createEslint()
|
|
33
|
+
const code = `// TODO: fix this later\nconst y = 2\n`
|
|
34
|
+
|
|
35
|
+
const results = await eslint.lintText(code, { filePath: "test.ts" })
|
|
36
|
+
const errors = results[0]?.messages.filter((message) => {
|
|
37
|
+
return message.ruleId === "dvukovic/document-todos"
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
expect(errors?.length).toBe(1)
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
test("reports FIXME without URL", async () => {
|
|
44
|
+
const eslint = createEslint()
|
|
45
|
+
const code = `// FIXME: broken feature\nconst y = 2\n`
|
|
46
|
+
|
|
47
|
+
const results = await eslint.lintText(code, { filePath: "test.ts" })
|
|
48
|
+
const errors = results[0]?.messages.filter((message) => {
|
|
49
|
+
return message.ruleId === "dvukovic/document-todos"
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
expect(errors?.length).toBe(1)
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
test("allows TODO with URL", async () => {
|
|
56
|
+
const eslint = createEslint()
|
|
57
|
+
const code = `// TODO: fix this later https://github.com/issue/1\nconst y = 2\n`
|
|
58
|
+
|
|
59
|
+
const results = await eslint.lintText(code, { filePath: "test.ts" })
|
|
60
|
+
const errors = results[0]?.messages.filter((message) => {
|
|
61
|
+
return message.ruleId === "dvukovic/document-todos"
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
expect(errors?.length).toBe(0)
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
test("allows FIXME with URL", async () => {
|
|
68
|
+
const eslint = createEslint()
|
|
69
|
+
const code = `// FIXME: broken feature http://jira.com/123\nconst y = 2\n`
|
|
70
|
+
|
|
71
|
+
const results = await eslint.lintText(code, { filePath: "test.ts" })
|
|
72
|
+
const errors = results[0]?.messages.filter((message) => {
|
|
73
|
+
return message.ruleId === "dvukovic/document-todos"
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
expect(errors?.length).toBe(0)
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
test("allows regular comments", async () => {
|
|
80
|
+
const eslint = createEslint()
|
|
81
|
+
const code = `// This is a regular comment\nconst y = 2\n`
|
|
82
|
+
|
|
83
|
+
const results = await eslint.lintText(code, { filePath: "test.ts" })
|
|
84
|
+
const errors = results[0]?.messages.filter((message) => {
|
|
85
|
+
return message.ruleId === "dvukovic/document-todos"
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
expect(errors?.length).toBe(0)
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
test("reports lowercase todo without URL", async () => {
|
|
92
|
+
const eslint = createEslint()
|
|
93
|
+
const code = `// todo fix this later\nconst y = 2\n`
|
|
94
|
+
|
|
95
|
+
const results = await eslint.lintText(code, { filePath: "test.ts" })
|
|
96
|
+
const errors = results[0]?.messages.filter((message) => {
|
|
97
|
+
return message.ruleId === "dvukovic/document-todos"
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
expect(errors?.length).toBe(1)
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
test("reports lowercase fixme without URL", async () => {
|
|
104
|
+
const eslint = createEslint()
|
|
105
|
+
const code = `// fixme broken feature\nconst y = 2\n`
|
|
106
|
+
|
|
107
|
+
const results = await eslint.lintText(code, { filePath: "test.ts" })
|
|
108
|
+
const errors = results[0]?.messages.filter((message) => {
|
|
109
|
+
return message.ruleId === "dvukovic/document-todos"
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
expect(errors?.length).toBe(1)
|
|
113
|
+
})
|
|
114
|
+
|
|
115
|
+
test("reports TODO in block comments without URL", async () => {
|
|
116
|
+
const eslint = createEslint()
|
|
117
|
+
const code = `/* TODO: fix this later */\nconst y = 2\n`
|
|
118
|
+
|
|
119
|
+
const results = await eslint.lintText(code, { filePath: "test.ts" })
|
|
120
|
+
const errors = results[0]?.messages.filter((message) => {
|
|
121
|
+
return message.ruleId === "dvukovic/document-todos"
|
|
122
|
+
})
|
|
123
|
+
|
|
124
|
+
expect(errors?.length).toBe(1)
|
|
125
|
+
})
|
|
126
|
+
|
|
127
|
+
test("allows TODO in block comments with URL", async () => {
|
|
128
|
+
const eslint = createEslint()
|
|
129
|
+
const code = `/* TODO: fix this https://example.com/issue/1 */\nconst y = 2\n`
|
|
130
|
+
|
|
131
|
+
const results = await eslint.lintText(code, { filePath: "test.ts" })
|
|
132
|
+
const errors = results[0]?.messages.filter((message) => {
|
|
133
|
+
return message.ruleId === "dvukovic/document-todos"
|
|
134
|
+
})
|
|
135
|
+
|
|
136
|
+
expect(errors?.length).toBe(0)
|
|
137
|
+
})
|
|
138
|
+
|
|
139
|
+
test("uses custom URL prefix", async () => {
|
|
140
|
+
const eslint = createEslint("https://jira.example.com")
|
|
141
|
+
const code = `// TODO: fix this https://jira.example.com/PROJ-123\nconst y = 2\n`
|
|
142
|
+
|
|
143
|
+
const results = await eslint.lintText(code, { filePath: "test.ts" })
|
|
144
|
+
const errors = results[0]?.messages.filter((message) => {
|
|
145
|
+
return message.ruleId === "dvukovic/document-todos"
|
|
146
|
+
})
|
|
147
|
+
|
|
148
|
+
expect(errors?.length).toBe(0)
|
|
149
|
+
})
|
|
150
|
+
|
|
151
|
+
test("reports when URL does not match custom prefix", async () => {
|
|
152
|
+
const eslint = createEslint("https://jira.example.com")
|
|
153
|
+
const code = `// TODO: fix this https://github.com/issue/1\nconst y = 2\n`
|
|
154
|
+
|
|
155
|
+
const results = await eslint.lintText(code, { filePath: "test.ts" })
|
|
156
|
+
const errors = results[0]?.messages.filter((message) => {
|
|
157
|
+
return message.ruleId === "dvukovic/document-todos"
|
|
158
|
+
})
|
|
159
|
+
|
|
160
|
+
expect(errors?.length).toBe(1)
|
|
161
|
+
})
|
|
162
|
+
|
|
163
|
+
test("reports multiple TODO comments without URLs", async () => {
|
|
164
|
+
const eslint = createEslint()
|
|
165
|
+
const code = `// TODO: first issue\n// TODO: second issue\nconst y = 2\n`
|
|
166
|
+
|
|
167
|
+
const results = await eslint.lintText(code, { filePath: "test.ts" })
|
|
168
|
+
const errors = results[0]?.messages.filter((message) => {
|
|
169
|
+
return message.ruleId === "dvukovic/document-todos"
|
|
170
|
+
})
|
|
171
|
+
|
|
172
|
+
expect(errors?.length).toBe(2)
|
|
173
|
+
})
|
|
174
|
+
})
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TypeScript ESLint configuration with parser setup and rules
|
|
3
|
-
*
|
|
4
|
-
* @param {import("@eslint/config-helpers").ConfigWithExtends & { onlyFiles?: string[] }} [config]
|
|
5
|
-
* - Additional config
|
|
6
|
-
*
|
|
7
|
-
* @returns {import("@eslint/config-helpers").ConfigWithExtends} ESLint config
|
|
8
|
-
*/
|
|
9
|
-
export function typescript(config?: import("@eslint/config-helpers").ConfigWithExtends & {
|
|
10
|
-
onlyFiles?: string[];
|
|
11
|
-
}): import("@eslint/config-helpers").ConfigWithExtends;
|
|
12
|
-
export const typescriptConfig: {
|
|
13
|
-
name?: string;
|
|
14
|
-
basePath?: string;
|
|
15
|
-
files: (string | string[])[];
|
|
16
|
-
ignores?: string[];
|
|
17
|
-
language?: string;
|
|
18
|
-
languageOptions?: import("@eslint/core").LanguageOptions;
|
|
19
|
-
linterOptions?: import("@eslint/core").LinterOptionsConfig;
|
|
20
|
-
processor?: string | import("@eslint/core").Processor;
|
|
21
|
-
plugins?: Record<string, import("@eslint/core").Plugin>;
|
|
22
|
-
rules?: Partial<import("@eslint/core").RulesConfig> | undefined;
|
|
23
|
-
settings?: Record<string, unknown>;
|
|
24
|
-
}[];
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/{eslint → src/eslint}/rules/no-commented-out-code/no-commented-out-code.utils.d.ts
RENAMED
|
File without changes
|
/package/dist/{eslint → src/eslint}/rules/no-restricted-dependencies/no-restricted-dependencies.d.ts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|