@dvukovic/style-guide 0.21.0 → 0.22.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/eslint/index.d.ts +1 -1
- package/dist/eslint/plugins/perfectionist.d.ts +2 -0
- package/dist/eslint/rules/no-t/no-t.d.ts +1 -1
- package/package.json +2 -6
- package/src/eslint/configs/core.js +3 -9
- package/src/eslint/configs/react.js +1 -1
- package/src/eslint/configs/typescript.js +0 -5
- package/src/eslint/index.js +1 -1
- package/src/eslint/plugins/perfectionist.js +86 -0
- package/src/eslint/plugins/stylistic.js +0 -1
- package/src/eslint/rules/no-t/no-t.js +7 -7
- package/dist/eslint/plugins/rimac.d.ts +0 -2
- package/dist/eslint/plugins/simple-import-sort.d.ts +0 -2
- package/dist/eslint/plugins/sort-destructure-keys.d.ts +0 -2
- package/dist/eslint/plugins/sort-keys-fix.d.ts +0 -2
- package/dist/eslint/plugins/typescript-sort-keys.d.ts +0 -2
- package/src/eslint/plugins/rimac.js +0 -11
- package/src/eslint/plugins/simple-import-sort.js +0 -12
- package/src/eslint/plugins/sort-destructure-keys.js +0 -11
- package/src/eslint/plugins/sort-keys-fix.js +0 -11
- package/src/eslint/plugins/typescript-sort-keys.js +0 -12
package/dist/eslint/index.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export { react } from "./configs/react.js";
|
|
|
20
20
|
export { storybook } from "./configs/storybook.js";
|
|
21
21
|
export { tanstackQuery } from "./configs/tanstack-query.js";
|
|
22
22
|
export { turbo } from "./configs/turbo.js";
|
|
23
|
-
export { typescript } from "./configs/typescript.js";
|
|
24
23
|
export { typescriptStrict } from "./configs/typescript-strict.js";
|
|
24
|
+
export { typescript } from "./configs/typescript.js";
|
|
25
25
|
export { vitest } from "./configs/vitest.js";
|
|
26
26
|
export { packageJson, packageJsonWorkspace } from "./configs/package-json.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export namespace noT {
|
|
2
2
|
function create(context: any): {
|
|
3
|
-
"TSTypeParameter > Identifier[name=/^.$/]"(node: any): void;
|
|
4
3
|
"TSTypeParameter > Identifier[name=/^.{2,}$/]"(node: any): void;
|
|
4
|
+
"TSTypeParameter > Identifier[name=/^.$/]"(node: any): void;
|
|
5
5
|
};
|
|
6
6
|
namespace meta {
|
|
7
7
|
namespace docs {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dvukovic/style-guide",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.0",
|
|
4
4
|
"description": "My own style guide",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -64,7 +64,6 @@
|
|
|
64
64
|
"@eslint-community/eslint-plugin-eslint-comments": "4.6.0",
|
|
65
65
|
"@eslint/config-helpers": "0.5.1",
|
|
66
66
|
"@next/eslint-plugin-next": "16.1.4",
|
|
67
|
-
"@rimac-technology/eslint-plugin": "1.5.0",
|
|
68
67
|
"@stylistic/eslint-plugin": "5.7.1",
|
|
69
68
|
"@tanstack/eslint-plugin-query": "5.91.4",
|
|
70
69
|
"@typescript-eslint/parser": "8.53.1",
|
|
@@ -76,18 +75,15 @@
|
|
|
76
75
|
"eslint-plugin-mobx": "0.0.13",
|
|
77
76
|
"eslint-plugin-n": "17.23.2",
|
|
78
77
|
"eslint-plugin-package-json": "0.88.2",
|
|
78
|
+
"eslint-plugin-perfectionist": "5.7.0",
|
|
79
79
|
"eslint-plugin-playwright": "2.5.0",
|
|
80
80
|
"eslint-plugin-promise": "7.2.1",
|
|
81
81
|
"eslint-plugin-react": "7.37.5",
|
|
82
82
|
"eslint-plugin-react-hooks": "7.0.1",
|
|
83
83
|
"eslint-plugin-security-node": "1.1.4",
|
|
84
|
-
"eslint-plugin-simple-import-sort": "12.1.1",
|
|
85
84
|
"eslint-plugin-sonarjs": "3.0.5",
|
|
86
|
-
"eslint-plugin-sort-destructure-keys": "2.0.0",
|
|
87
|
-
"eslint-plugin-sort-keys-fix": "1.1.2",
|
|
88
85
|
"eslint-plugin-storybook": "10.2.0",
|
|
89
86
|
"eslint-plugin-turbo": "2.8.1",
|
|
90
|
-
"eslint-plugin-typescript-sort-keys": "3.3.0",
|
|
91
87
|
"eslint-plugin-unicorn": "62.0.0",
|
|
92
88
|
"eslint-plugin-unused-imports": "4.3.0",
|
|
93
89
|
"globals": "17.1.0",
|
|
@@ -2,15 +2,12 @@ import { ALL_JS_TS_FILES } from "../file-patterns.js"
|
|
|
2
2
|
import { arrayFunction } from "../plugins/array-function.js"
|
|
3
3
|
import { baseline } from "../plugins/baseline.js"
|
|
4
4
|
import { dvukovic } from "../plugins/dvukovic.js"
|
|
5
|
-
import { eslint } from "../plugins/eslint.js"
|
|
6
5
|
import { eslintComments } from "../plugins/eslint-comments.js"
|
|
6
|
+
import { eslint } from "../plugins/eslint.js"
|
|
7
7
|
import { importX } from "../plugins/import-x.js"
|
|
8
|
+
import { perfectionist } from "../plugins/perfectionist.js"
|
|
8
9
|
import { promise } from "../plugins/promise.js"
|
|
9
|
-
import { rimac } from "../plugins/rimac.js"
|
|
10
|
-
import { simpleImportSort } from "../plugins/simple-import-sort.js"
|
|
11
10
|
import { sonarjs } from "../plugins/sonarjs.js"
|
|
12
|
-
import { sortDestructureKeys } from "../plugins/sort-destructure-keys.js"
|
|
13
|
-
import { sortKeysFix } from "../plugins/sort-keys-fix.js"
|
|
14
11
|
import { stylistic } from "../plugins/stylistic.js"
|
|
15
12
|
import { unicorn } from "../plugins/unicorn.js"
|
|
16
13
|
import { unusedImports } from "../plugins/unused-imports.js"
|
|
@@ -22,11 +19,8 @@ export const coreConfig = [
|
|
|
22
19
|
eslintComments,
|
|
23
20
|
importX,
|
|
24
21
|
promise,
|
|
25
|
-
|
|
26
|
-
simpleImportSort,
|
|
22
|
+
perfectionist,
|
|
27
23
|
sonarjs,
|
|
28
|
-
sortDestructureKeys,
|
|
29
|
-
sortKeysFix,
|
|
30
24
|
stylistic,
|
|
31
25
|
unicorn,
|
|
32
26
|
unusedImports,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { REACT_FILES } from "../file-patterns.js"
|
|
2
|
-
import { react as reactPlugin } from "../plugins/react.js"
|
|
3
2
|
import { reactHooks as reactHooksPlugin } from "../plugins/react-hooks.js"
|
|
3
|
+
import { react as reactPlugin } from "../plugins/react.js"
|
|
4
4
|
|
|
5
5
|
export const reactConfig = [reactPlugin, reactHooksPlugin]
|
|
6
6
|
|
|
@@ -2,7 +2,6 @@ import tseslint from "typescript-eslint"
|
|
|
2
2
|
|
|
3
3
|
import { ALL_JS_TS_FILES, TS_FILES } from "../file-patterns.js"
|
|
4
4
|
import { typescriptEslint } from "../plugins/typescript-eslint.js"
|
|
5
|
-
import { typescriptSortKeys } from "../plugins/typescript-sort-keys.js"
|
|
6
5
|
|
|
7
6
|
/** @type {import("eslint").Linter.Config[]} */
|
|
8
7
|
export const typescriptConfig = [
|
|
@@ -20,10 +19,6 @@ export const typescriptConfig = [
|
|
|
20
19
|
files: [...TS_FILES, "**/*.tsx"],
|
|
21
20
|
...typescriptEslint,
|
|
22
21
|
},
|
|
23
|
-
{
|
|
24
|
-
files: [...TS_FILES, "**/*.tsx"],
|
|
25
|
-
...typescriptSortKeys,
|
|
26
|
-
},
|
|
27
22
|
]
|
|
28
23
|
|
|
29
24
|
/**
|
package/src/eslint/index.js
CHANGED
|
@@ -39,6 +39,6 @@ export { react } from "./configs/react.js"
|
|
|
39
39
|
export { storybook } from "./configs/storybook.js"
|
|
40
40
|
export { tanstackQuery } from "./configs/tanstack-query.js"
|
|
41
41
|
export { turbo } from "./configs/turbo.js"
|
|
42
|
-
export { typescript } from "./configs/typescript.js"
|
|
43
42
|
export { typescriptStrict } from "./configs/typescript-strict.js"
|
|
43
|
+
export { typescript } from "./configs/typescript.js"
|
|
44
44
|
export { vitest } from "./configs/vitest.js"
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import plugin from "eslint-plugin-perfectionist"
|
|
2
|
+
|
|
3
|
+
/** @type {import("@eslint/config-helpers").Config} */
|
|
4
|
+
export const perfectionist = {
|
|
5
|
+
plugins: {
|
|
6
|
+
perfectionist: plugin,
|
|
7
|
+
},
|
|
8
|
+
rules: {
|
|
9
|
+
"perfectionist/sort-classes": [
|
|
10
|
+
"error",
|
|
11
|
+
{
|
|
12
|
+
groups: [
|
|
13
|
+
"index-signature",
|
|
14
|
+
"static-block",
|
|
15
|
+
["static-property", "static-accessor-property"],
|
|
16
|
+
["static-get-method", "static-set-method"],
|
|
17
|
+
"static-method",
|
|
18
|
+
["property", "accessor-property"],
|
|
19
|
+
["get-method", "set-method"],
|
|
20
|
+
"constructor",
|
|
21
|
+
"method",
|
|
22
|
+
"unknown",
|
|
23
|
+
],
|
|
24
|
+
newlinesBetween: 1,
|
|
25
|
+
newlinesInside: 1,
|
|
26
|
+
type: "alphabetical",
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
"perfectionist/sort-enums": [
|
|
30
|
+
"error",
|
|
31
|
+
{
|
|
32
|
+
type: "alphabetical",
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
"perfectionist/sort-exports": [
|
|
36
|
+
"error",
|
|
37
|
+
{
|
|
38
|
+
type: "alphabetical",
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
"perfectionist/sort-imports": [
|
|
42
|
+
"error",
|
|
43
|
+
{
|
|
44
|
+
groups: [
|
|
45
|
+
"side-effect",
|
|
46
|
+
"builtin",
|
|
47
|
+
"external",
|
|
48
|
+
"internal",
|
|
49
|
+
["parent", "sibling", "index"],
|
|
50
|
+
],
|
|
51
|
+
newlinesBetween: 1,
|
|
52
|
+
type: "alphabetical",
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
"perfectionist/sort-interfaces": [
|
|
56
|
+
"error",
|
|
57
|
+
{
|
|
58
|
+
type: "alphabetical",
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
"perfectionist/sort-named-exports": [
|
|
62
|
+
"error",
|
|
63
|
+
{
|
|
64
|
+
type: "alphabetical",
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
"perfectionist/sort-named-imports": [
|
|
68
|
+
"error",
|
|
69
|
+
{
|
|
70
|
+
type: "alphabetical",
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
"perfectionist/sort-object-types": [
|
|
74
|
+
"error",
|
|
75
|
+
{
|
|
76
|
+
type: "alphabetical",
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
"perfectionist/sort-objects": [
|
|
80
|
+
"error",
|
|
81
|
+
{
|
|
82
|
+
type: "alphabetical",
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
},
|
|
86
|
+
}
|
|
@@ -3,13 +3,6 @@ export const noT = {
|
|
|
3
3
|
const [{ prefix = "" } = {}] = context.options
|
|
4
4
|
|
|
5
5
|
return {
|
|
6
|
-
"TSTypeParameter > Identifier[name=/^.$/]"(node) {
|
|
7
|
-
context.report({
|
|
8
|
-
data: { name: node.name },
|
|
9
|
-
messageId: "forbidden",
|
|
10
|
-
node,
|
|
11
|
-
})
|
|
12
|
-
},
|
|
13
6
|
"TSTypeParameter > Identifier[name=/^.{2,}$/]"(node) {
|
|
14
7
|
if (prefix && !node.name.startsWith(prefix)) {
|
|
15
8
|
context.report({
|
|
@@ -19,6 +12,13 @@ export const noT = {
|
|
|
19
12
|
})
|
|
20
13
|
}
|
|
21
14
|
},
|
|
15
|
+
"TSTypeParameter > Identifier[name=/^.$/]"(node) {
|
|
16
|
+
context.report({
|
|
17
|
+
data: { name: node.name },
|
|
18
|
+
messageId: "forbidden",
|
|
19
|
+
node,
|
|
20
|
+
})
|
|
21
|
+
},
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
meta: {
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import plugin from "@rimac-technology/eslint-plugin"
|
|
2
|
-
|
|
3
|
-
/** @type {import("@eslint/config-helpers").Config} */
|
|
4
|
-
export const rimac = {
|
|
5
|
-
plugins: {
|
|
6
|
-
"@rimac-technology": plugin,
|
|
7
|
-
},
|
|
8
|
-
rules: {
|
|
9
|
-
"@rimac-technology/class-element-sorting": "error",
|
|
10
|
-
},
|
|
11
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import plugin from "eslint-plugin-simple-import-sort"
|
|
2
|
-
|
|
3
|
-
/** @type {import("@eslint/config-helpers").Config} */
|
|
4
|
-
export const simpleImportSort = {
|
|
5
|
-
plugins: {
|
|
6
|
-
"simple-import-sort": plugin,
|
|
7
|
-
},
|
|
8
|
-
rules: {
|
|
9
|
-
"simple-import-sort/exports": "error",
|
|
10
|
-
"simple-import-sort/imports": "error",
|
|
11
|
-
},
|
|
12
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import plugin from "eslint-plugin-sort-destructure-keys"
|
|
2
|
-
|
|
3
|
-
/** @type {import("@eslint/config-helpers").Config} */
|
|
4
|
-
export const sortDestructureKeys = {
|
|
5
|
-
plugins: {
|
|
6
|
-
"sort-destructure-keys": plugin,
|
|
7
|
-
},
|
|
8
|
-
rules: {
|
|
9
|
-
"sort-destructure-keys/sort-destructure-keys": "error",
|
|
10
|
-
},
|
|
11
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import plugin from "eslint-plugin-typescript-sort-keys"
|
|
2
|
-
|
|
3
|
-
/** @type {import("@eslint/config-helpers").Config} */
|
|
4
|
-
export const typescriptSortKeys = {
|
|
5
|
-
plugins: {
|
|
6
|
-
"typescript-sort-keys": plugin,
|
|
7
|
-
},
|
|
8
|
-
rules: {
|
|
9
|
-
"typescript-sort-keys/interface": "error",
|
|
10
|
-
"typescript-sort-keys/string-enum": "error",
|
|
11
|
-
},
|
|
12
|
-
}
|