@tcy/eslint-rules 1.4.1 → 1.4.3

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.
@@ -0,0 +1,155 @@
1
+ declare namespace _default {
2
+ export namespace plugins {
3
+ namespace tcy {
4
+ let rules: {
5
+ 'import-specifiers-per-line': {
6
+ meta: {
7
+ type: string;
8
+ docs: {
9
+ description: string;
10
+ };
11
+ fixable: string;
12
+ schema: {
13
+ type: string;
14
+ properties: {
15
+ maxSpecifiers: {
16
+ type: string;
17
+ default: number;
18
+ };
19
+ maxLen: {
20
+ type: string;
21
+ default: number;
22
+ };
23
+ };
24
+ additionalProperties: boolean;
25
+ }[];
26
+ };
27
+ create(context: any): {
28
+ ImportDeclaration(node: any): void;
29
+ };
30
+ };
31
+ 'array-elements-per-line': {
32
+ meta: {
33
+ type: string;
34
+ docs: {
35
+ description: string;
36
+ category: string;
37
+ recommended: boolean;
38
+ };
39
+ fixable: string;
40
+ schema: never[];
41
+ };
42
+ create(context: any): {
43
+ ArrayExpression(node: any): void;
44
+ };
45
+ };
46
+ 'export-specifiers-per-line': {
47
+ meta: {
48
+ type: string;
49
+ docs: {
50
+ description: string;
51
+ };
52
+ fixable: string;
53
+ schema: never[];
54
+ };
55
+ create(context: any): {
56
+ ExportNamedDeclaration(node: any): void;
57
+ };
58
+ };
59
+ 'jsx-expression-string-literals': {
60
+ meta: {
61
+ type: string;
62
+ docs: {
63
+ description: string;
64
+ };
65
+ fixable: string;
66
+ schema: never[];
67
+ };
68
+ create(context: any): {
69
+ JSXAttribute(node: any): void;
70
+ };
71
+ };
72
+ 'enforce-tailwind-important': {
73
+ meta: {
74
+ type: string;
75
+ docs: {
76
+ description: string;
77
+ recommended: boolean;
78
+ };
79
+ fixable: string;
80
+ schema: never[];
81
+ messages: {
82
+ missingImportant: string;
83
+ };
84
+ };
85
+ create(context: any): {
86
+ JSXAttribute(node: any): void;
87
+ VariableDeclarator(node: any): void;
88
+ };
89
+ };
90
+ 'v-model-name-match': {
91
+ meta: {
92
+ type: string;
93
+ docs: {
94
+ description: string;
95
+ recommended: boolean;
96
+ };
97
+ schema: never[];
98
+ messages: {
99
+ mismatch: string;
100
+ };
101
+ };
102
+ create(context: any): {
103
+ JSXOpeningElement(node: any): void;
104
+ };
105
+ };
106
+ 'decorator-type-enforcement': {
107
+ meta: {
108
+ type: string;
109
+ docs: {
110
+ description: string;
111
+ category: string;
112
+ recommended: boolean;
113
+ };
114
+ fixable: string;
115
+ schema: never[];
116
+ };
117
+ create(context: any): {
118
+ PropertyDefinition(node: any): void;
119
+ };
120
+ };
121
+ 'vuejs-define-component': {
122
+ meta: {
123
+ type: string;
124
+ docs: {
125
+ description: string;
126
+ recommended: boolean;
127
+ };
128
+ schema: never[];
129
+ };
130
+ create(context: any): {
131
+ ExportDefaultDeclaration(node: any): void;
132
+ };
133
+ };
134
+ 'vuejs-define-workspace': {
135
+ meta: {
136
+ type: string;
137
+ docs: {
138
+ description: string;
139
+ recommended: boolean;
140
+ };
141
+ schema: never[];
142
+ };
143
+ create(context: any): {
144
+ ExportDefaultDeclaration?: undefined;
145
+ } | {
146
+ ExportDefaultDeclaration(node: any): void;
147
+ };
148
+ };
149
+ };
150
+ }
151
+ }
152
+ let rules_1: {};
153
+ export { rules_1 as rules };
154
+ }
155
+ export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tcy/eslint-rules",
3
- "version": "1.4.1",
3
+ "version": "1.4.3",
4
4
  "description": "```typescript import { plugin as customRules } from 'tcy@eslint-rules/src/index.mjs';",
5
5
  "homepage": "https://github.com/tcastelly/eslint-rules#readme",
6
6
  "bugs": {
@@ -15,6 +15,10 @@
15
15
  "type": "module",
16
16
  "main": "src/index.js",
17
17
  "types": "dist/index.d.ts",
18
+ "exports": {
19
+ "./client": "./dist/client.d.ts",
20
+ "./back": "./dist/back.d.ts"
21
+ },
18
22
  "scripts": {
19
23
  "build:decl": "tsc",
20
24
  "clean": "rimraf dist",
package/src/back.js ADDED
@@ -0,0 +1,10 @@
1
+ import pluginConfig from './plugin.js'
2
+
3
+ export default {
4
+ ...pluginConfig,
5
+ rules: {
6
+ 'tcy/import-specifiers-per-line': ['error', { maxSpecifiers: 4 }],
7
+ 'tcy/export-specifiers-per-line': 'error',
8
+ 'tcy/array-elements-per-line': 'error',
9
+ }
10
+ }
package/src/client.js ADDED
@@ -0,0 +1,15 @@
1
+ import pluginConfig from './plugin.js'
2
+
3
+ export default {
4
+ ...pluginConfig,
5
+ rules: {
6
+ 'tcy/import-specifiers-per-line': ['error', { maxSpecifiers: 4 }],
7
+ 'tcy/export-specifiers-per-line': 'error',
8
+ 'tcy/array-elements-per-line': 'error',
9
+ 'tcy/jsx-expression-string-literals': 'error',
10
+ 'tcy/enforce-tailwind-important': 'error',
11
+ 'tcy/v-model-name-match': 'error',
12
+ 'tcy/vuejs-define-component': 'error',
13
+ 'tcy/vuejs-define-workspace': 'error',
14
+ }
15
+ }
package/src/index.js CHANGED
@@ -1,93 +1,2 @@
1
- import importSpecifiersPerLineRule from './import-specifiers-per-line.js';
2
- import arrayElementsPerLineRule from './array-elements-per-line.js';
3
- import exportSpecifiersPerLineRule from './export-specifiers-per-line.js';
4
- import jsxExpressionStringLiterals from './jsx-expression-string-literals.js';
5
- import enforceTailwindImportant from './enforce-tailwind-important.js';
6
- import vModelNameMatch from './v-model-name-match.js';
7
- import decoratorTypeEnforcement from './decorator-type-enforcement.js'
8
- import vuejsDefineComponent from './vuejs-define-component.js'
9
- import vuejsDefineWorkspace from './vuejs-define-workspace.js'
10
-
11
- export const customVueJSComponents = {
12
- rules: {
13
- 'no-restricted-syntax': [
14
- 'error',
15
- // Force to use `const` with props. This is mandatory to be able to use correctly the custom defineComponent
16
- {
17
- // Targets: defineComponent({ props: { ... } })
18
- selector: [
19
- ':matches(CallExpression[callee.name=\'defineComponent\'], CallExpression[callee.name=\'withVModelTSX\'])',
20
- ' > ObjectExpression',
21
- ' > Property[key.name=\'props\']',
22
- '[value.type=\'ObjectExpression\']',
23
- ].join(''),
24
- message: 'Component props must use \'as const\' for correct type inference.',
25
- },
26
- // Only target variables named 'props' that are actually component props
27
- {
28
- selector: ['VariableDeclarator[id.name=\'props\']', '[init.type=\'ObjectExpression\']'].join(''),
29
- message: 'Variables named \'props\' used for component definitions must use \'as const\'.',
30
- },
31
-
32
- // it makes no sense to have required + default in PropType
33
- {
34
- selector: [
35
- 'VariableDeclarator[id.name=\'props\']',
36
- ' Property[value.type=\'ObjectExpression\']',
37
- ':has(Property[key.name=\'required\'] > Literal[value=true])',
38
- ':has(Property[key.name=\'default\'])',
39
- ].join(''),
40
- message: 'Prop cannot be \'required\' and have a \'default\' value. Required props are guaranteed by the caller; a default is unreachable.',
41
- },
42
-
43
- {
44
- selector: [
45
- 'TSTypeAliasDeclaration',
46
- ':has(Identifier[name=\'Context\'])',
47
- ' TSIntersectionType',
48
- ].join(''),
49
- message: 'Do not merge multiple Context calls with \'&\'. Use a single Context call to keep component boundaries clean.',
50
- },
51
-
52
- {
53
- selector: 'ImportSpecifier[importKind=\'type\']',
54
- message: 'Use a separate `import type { ... }` statement.',
55
- },
56
- ],
57
- 'no-restricted-imports': [ // force to use `useMutationWithError`
58
- 'error',
59
- {
60
- paths: [
61
- {
62
- name: 'vue-use-async',
63
- importNames: ['useMutation'],
64
- message: 'useMutation is forbidden',
65
- },
66
- {
67
- name: '@taz-rex/vue-widgets/dist',
68
- message: 'Do not import from /dist. Use \'@taz-rex/vue-widgets\' instead.',
69
- },
70
- {
71
- name: 'vue',
72
- importNames: ['defineComponent'],
73
- message: 'defineComponent is forbidden',
74
- },
75
- ],
76
- },
77
- ],
78
- }
79
- }
80
-
81
- export default {
82
- rules: {
83
- 'import-specifiers-per-line': importSpecifiersPerLineRule,
84
- 'array-elements-per-line': arrayElementsPerLineRule,
85
- 'export-specifiers-per-line': exportSpecifiersPerLineRule,
86
- 'jsx-expression-string-literals': jsxExpressionStringLiterals,
87
- 'enforce-tailwind-important': enforceTailwindImportant,
88
- 'v-model-name-match': vModelNameMatch,
89
- 'decorator-type-enforcement': decoratorTypeEnforcement,
90
- 'vuejs-define-component': vuejsDefineComponent,
91
- 'vuejs-define-workspace': vuejsDefineWorkspace,
92
- },
93
- };
1
+ export * as client from './client.js'
2
+ export * as back from './back.js'
package/src/plugin.js ADDED
@@ -0,0 +1,29 @@
1
+ import importSpecifiersPerLineRule from './import-specifiers-per-line.js';
2
+ import arrayElementsPerLineRule from './array-elements-per-line.js';
3
+ import exportSpecifiersPerLineRule from './export-specifiers-per-line.js';
4
+ import jsxExpressionStringLiterals from './jsx-expression-string-literals.js';
5
+ import enforceTailwindImportant from './enforce-tailwind-important.js';
6
+ import vModelNameMatch from './v-model-name-match.js';
7
+ import decoratorTypeEnforcement from './decorator-type-enforcement.js'
8
+ import vuejsDefineComponent from './vuejs-define-component.js'
9
+ import vuejsDefineWorkspace from './vuejs-define-workspace.js'
10
+
11
+ export default {
12
+ plugins: {
13
+ tcy: {
14
+ rules: {
15
+ 'import-specifiers-per-line': importSpecifiersPerLineRule,
16
+ 'array-elements-per-line': arrayElementsPerLineRule,
17
+ 'export-specifiers-per-line': exportSpecifiersPerLineRule,
18
+ 'jsx-expression-string-literals': jsxExpressionStringLiterals,
19
+ 'enforce-tailwind-important': enforceTailwindImportant,
20
+ 'v-model-name-match': vModelNameMatch,
21
+ 'decorator-type-enforcement': decoratorTypeEnforcement,
22
+ 'vuejs-define-component': vuejsDefineComponent,
23
+ 'vuejs-define-workspace': vuejsDefineWorkspace,
24
+ }
25
+ }
26
+ },
27
+ rules: {
28
+ },
29
+ };