@akinon/eslint-plugin-projectzero 1.13.0 → 1.14.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/.prettierrc +13 -13
- package/CHANGELOG.md +8 -0
- package/README.md +30 -30
- package/configs/core.ts +20 -19
- package/configs/index.ts +4 -4
- package/configs/recommended.ts +23 -23
- package/dist/configs/core.js +1 -0
- package/dist/rules/common.js +149 -149
- package/dist/rules/index.js +3 -1
- package/dist/rules/urls-without-slash.js +40 -0
- package/index.ts +2 -2
- package/package.json +1 -1
- package/rules/check-locale.ts +78 -78
- package/rules/check-middleware-order.ts +64 -64
- package/rules/client-url.ts +44 -44
- package/rules/image-import.ts +44 -44
- package/rules/index.ts +23 -21
- package/rules/link-import.ts +44 -44
- package/rules/meta-data-import.ts +50 -50
- package/rules/router-import.ts +44 -44
- package/rules/skip-trailing-slash-redirect.ts +60 -60
- package/rules/urls-without-slash.ts +44 -0
- package/tsconfig.json +103 -103
package/.prettierrc
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
{
|
|
2
|
-
"bracketSameLine": false,
|
|
3
|
-
"tabWidth": 2,
|
|
4
|
-
"singleQuote": true,
|
|
5
|
-
"jsxSingleQuote": false,
|
|
6
|
-
"bracketSpacing": true,
|
|
7
|
-
"semi": true,
|
|
8
|
-
"useTabs": false,
|
|
9
|
-
"arrowParens": "always",
|
|
10
|
-
"endOfLine": "lf",
|
|
11
|
-
"proseWrap": "never",
|
|
12
|
-
"trailingComma": "none"
|
|
13
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"bracketSameLine": false,
|
|
3
|
+
"tabWidth": 2,
|
|
4
|
+
"singleQuote": true,
|
|
5
|
+
"jsxSingleQuote": false,
|
|
6
|
+
"bracketSpacing": true,
|
|
7
|
+
"semi": true,
|
|
8
|
+
"useTabs": false,
|
|
9
|
+
"arrowParens": "always",
|
|
10
|
+
"endOfLine": "lf",
|
|
11
|
+
"proseWrap": "never",
|
|
12
|
+
"trailingComma": "none"
|
|
13
|
+
}
|
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
# @akinon/eslint-plugin-projectzero
|
|
3
|
-
|
|
4
|
-
ESLint plugin for **Project Zero PWA**.
|
|
5
|
-
It includes core and recommended rule sets.
|
|
6
|
-
|
|
7
|
-
## Build
|
|
8
|
-
|
|
9
|
-
yarn build
|
|
10
|
-
or
|
|
11
|
-
npm run build
|
|
12
|
-
|
|
13
|
-
## Installation
|
|
14
|
-
|
|
15
|
-
yarn add -D git+ssh://git@bitbucket.org/akinonteam/eslint-plugin-projectzero.git
|
|
16
|
-
|
|
17
|
-
## Usage
|
|
18
|
-
|
|
19
|
-
Add the following lines to **.eslintrc.js** file.
|
|
20
|
-
|
|
21
|
-
extends: [
|
|
22
|
-
...
|
|
23
|
-
...
|
|
24
|
-
'plugin:@akinon/projectzero/core', // DO NOT remove this config for stability
|
|
25
|
-
'plugin:@akinon/projectzero/recommended' // Optional
|
|
26
|
-
],
|
|
27
|
-
plugins: [
|
|
28
|
-
...
|
|
29
|
-
'@akinon/projectzero'
|
|
30
|
-
]
|
|
1
|
+
|
|
2
|
+
# @akinon/eslint-plugin-projectzero
|
|
3
|
+
|
|
4
|
+
ESLint plugin for **Project Zero PWA**.
|
|
5
|
+
It includes core and recommended rule sets.
|
|
6
|
+
|
|
7
|
+
## Build
|
|
8
|
+
|
|
9
|
+
yarn build
|
|
10
|
+
or
|
|
11
|
+
npm run build
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
yarn add -D git+ssh://git@bitbucket.org/akinonteam/eslint-plugin-projectzero.git
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
Add the following lines to **.eslintrc.js** file.
|
|
20
|
+
|
|
21
|
+
extends: [
|
|
22
|
+
...
|
|
23
|
+
...
|
|
24
|
+
'plugin:@akinon/projectzero/core', // DO NOT remove this config for stability
|
|
25
|
+
'plugin:@akinon/projectzero/recommended' // Optional
|
|
26
|
+
],
|
|
27
|
+
plugins: [
|
|
28
|
+
...
|
|
29
|
+
'@akinon/projectzero'
|
|
30
|
+
]
|
package/configs/core.ts
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
rules: {
|
|
3
|
-
'@akinon/projectzero/image-import': 'error',
|
|
4
|
-
'@akinon/projectzero/client-url': 'error',
|
|
5
|
-
'@akinon/projectzero/link-import': 'error',
|
|
6
|
-
'@akinon/projectzero/router-import': 'error',
|
|
7
|
-
'@akinon/projectzero/skip-trailing-slash-redirect': 'error',
|
|
8
|
-
'@akinon/projectzero/check-locale': 'error',
|
|
9
|
-
'@akinon/projectzero/meta-data-import': 'error',
|
|
10
|
-
'
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
1
|
+
export default {
|
|
2
|
+
rules: {
|
|
3
|
+
'@akinon/projectzero/image-import': 'error',
|
|
4
|
+
'@akinon/projectzero/client-url': 'error',
|
|
5
|
+
'@akinon/projectzero/link-import': 'error',
|
|
6
|
+
'@akinon/projectzero/router-import': 'error',
|
|
7
|
+
'@akinon/projectzero/skip-trailing-slash-redirect': 'error',
|
|
8
|
+
'@akinon/projectzero/check-locale': 'error',
|
|
9
|
+
'@akinon/projectzero/meta-data-import': 'error',
|
|
10
|
+
'@akinon/projectzero/urls-without-slash': 'error',
|
|
11
|
+
'no-restricted-syntax': [
|
|
12
|
+
'error',
|
|
13
|
+
{
|
|
14
|
+
selector:
|
|
15
|
+
"MemberExpression[property.name='COMMERCE_URL'][object.property.name='env'][object.object.name='process']",
|
|
16
|
+
message: "You should use it as 'Settings.commerceUrl'"
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
};
|
package/configs/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import core from './core';
|
|
2
|
-
import recommended from './recommended';
|
|
3
|
-
|
|
4
|
-
export { core, recommended };
|
|
1
|
+
import core from './core';
|
|
2
|
+
import recommended from './recommended';
|
|
3
|
+
|
|
4
|
+
export { core, recommended };
|
package/configs/recommended.ts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
rules: {
|
|
3
|
-
'@next/next/no-html-link-for-pages': 'off',
|
|
4
|
-
'@next/next/no-server-import-in-page': 'off',
|
|
5
|
-
'@typescript-eslint/no-var-requires': 0,
|
|
6
|
-
'@typescript-eslint/no-empty-interface': [
|
|
7
|
-
'error',
|
|
8
|
-
{
|
|
9
|
-
allowSingleExtends: false
|
|
10
|
-
}
|
|
11
|
-
],
|
|
12
|
-
'no-console': ['error', { allow: ['error', 'warn'] }],
|
|
13
|
-
'no-empty-function': [
|
|
14
|
-
'error',
|
|
15
|
-
{ allow: ['arrowFunctions', 'functions', 'methods'] }
|
|
16
|
-
],
|
|
17
|
-
'object-shorthand': [
|
|
18
|
-
'error',
|
|
19
|
-
'always',
|
|
20
|
-
{ ignoreConstructors: false, avoidQuotes: true }
|
|
21
|
-
]
|
|
22
|
-
}
|
|
23
|
-
};
|
|
1
|
+
export default {
|
|
2
|
+
rules: {
|
|
3
|
+
'@next/next/no-html-link-for-pages': 'off',
|
|
4
|
+
'@next/next/no-server-import-in-page': 'off',
|
|
5
|
+
'@typescript-eslint/no-var-requires': 0,
|
|
6
|
+
'@typescript-eslint/no-empty-interface': [
|
|
7
|
+
'error',
|
|
8
|
+
{
|
|
9
|
+
allowSingleExtends: false
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
'no-console': ['error', { allow: ['error', 'warn'] }],
|
|
13
|
+
'no-empty-function': [
|
|
14
|
+
'error',
|
|
15
|
+
{ allow: ['arrowFunctions', 'functions', 'methods'] }
|
|
16
|
+
],
|
|
17
|
+
'object-shorthand': [
|
|
18
|
+
'error',
|
|
19
|
+
'always',
|
|
20
|
+
{ ignoreConstructors: false, avoidQuotes: true }
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
};
|
package/dist/configs/core.js
CHANGED
|
@@ -9,6 +9,7 @@ exports.default = {
|
|
|
9
9
|
'@akinon/projectzero/skip-trailing-slash-redirect': 'error',
|
|
10
10
|
'@akinon/projectzero/check-locale': 'error',
|
|
11
11
|
'@akinon/projectzero/meta-data-import': 'error',
|
|
12
|
+
'@akinon/projectzero/urls-without-slash': 'error',
|
|
12
13
|
'no-restricted-syntax': [
|
|
13
14
|
'error',
|
|
14
15
|
{
|
package/dist/rules/common.js
CHANGED
|
@@ -1,149 +1,149 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = {
|
|
4
|
-
env: {
|
|
5
|
-
browser: true,
|
|
6
|
-
es6: true,
|
|
7
|
-
node: true,
|
|
8
|
-
},
|
|
9
|
-
plugins: ["@typescript-eslint"],
|
|
10
|
-
parser: "@typescript-eslint/parser",
|
|
11
|
-
parserOptions: {
|
|
12
|
-
ecmaVersion: 2021,
|
|
13
|
-
sourceType: "module",
|
|
14
|
-
},
|
|
15
|
-
rules: {
|
|
16
|
-
// "array-callback-return": ["error", { allowImplicit: true }],
|
|
17
|
-
// curly: "error",
|
|
18
|
-
// "dot-notation": ["error", { allowKeywords: true }],
|
|
19
|
-
// "dot-location": ["error", "property"],
|
|
20
|
-
// "max-classes-per-file": ["error", 1],
|
|
21
|
-
"no-console": "error",
|
|
22
|
-
// "no-else-return": ["error", { allowElseIf: true }],
|
|
23
|
-
// "no-empty-function": [
|
|
24
|
-
// "error",
|
|
25
|
-
// { allow: ["arrowFunctions", "functions", "methods"] },
|
|
26
|
-
// ],
|
|
27
|
-
// "no-eval": "error",
|
|
28
|
-
// "no-extra-bind": "error",
|
|
29
|
-
// "no-lone-blocks": "error",
|
|
30
|
-
// "no-multi-spaces": ["error", { ignoreEOLComments: false }],
|
|
31
|
-
// "no-useless-concat": "error",
|
|
32
|
-
// "no-useless-return": "error",
|
|
33
|
-
// yoda: "error",
|
|
34
|
-
// // ES6
|
|
35
|
-
// "arrow-body-style": ["error", "as-needed"],
|
|
36
|
-
// "arrow-parens": ["error", "always"],
|
|
37
|
-
// "arrow-spacing": ["error", { before: true, after: true }],
|
|
38
|
-
// "no-confusing-arrow": ["error", { allowParens: true }],
|
|
39
|
-
// "no-const-assign": "error",
|
|
40
|
-
// "no-dupe-class-members": "error",
|
|
41
|
-
// "no-useless-rename": [
|
|
42
|
-
// "error",
|
|
43
|
-
// { ignoreDestructuring: false, ignoreImport: false, ignoreExport: false },
|
|
44
|
-
// ],
|
|
45
|
-
// "object-shorthand": [
|
|
46
|
-
// "error",
|
|
47
|
-
// "always",
|
|
48
|
-
// { ignoreConstructors: false, avoidQuotes: true },
|
|
49
|
-
// ],
|
|
50
|
-
// "prefer-arrow-callback": [
|
|
51
|
-
// "error",
|
|
52
|
-
// { allowNamedFunctions: false, allowUnboundThis: true },
|
|
53
|
-
// ],
|
|
54
|
-
// "prefer-template": "error",
|
|
55
|
-
// "rest-spread-spacing": ["error", "never"],
|
|
56
|
-
// "template-curly-spacing": "error",
|
|
57
|
-
// // Style
|
|
58
|
-
// "array-bracket-newline": ["error", { multiline: true, minItems: 4 }],
|
|
59
|
-
// "array-element-newline": ["error", { multiline: true, minItems: 4 }],
|
|
60
|
-
// "array-bracket-spacing": ["error", "never"],
|
|
61
|
-
// "block-spacing": ["error", "always"],
|
|
62
|
-
// "brace-style": ["error", "1tbs", { allowSingleLine: true }],
|
|
63
|
-
// camelcase: [
|
|
64
|
-
// "error",
|
|
65
|
-
// {
|
|
66
|
-
// ignoreDestructuring: true,
|
|
67
|
-
// properties: "never",
|
|
68
|
-
// allow: ["non_field_errors"],
|
|
69
|
-
// },
|
|
70
|
-
// ],
|
|
71
|
-
// "comma-spacing": ["error", { before: false, after: true }],
|
|
72
|
-
// "eol-last": ["error", "always"],
|
|
73
|
-
// "func-call-spacing": ["error", "never"],
|
|
74
|
-
// "func-names": "warn",
|
|
75
|
-
// "function-paren-newline": ["error", "consistent"],
|
|
76
|
-
// indent: ["error", 2, { ignoredNodes: ["TemplateLiteral *"] }],
|
|
77
|
-
// "key-spacing": ["error", { beforeColon: false, afterColon: true }],
|
|
78
|
-
// "keyword-spacing": ["error", { before: true, after: true }],
|
|
79
|
-
// "lines-between-class-members": ["error", "always"],
|
|
80
|
-
// "max-len": ["error", { code: 125, ignoreUrls: true }],
|
|
81
|
-
// "new-cap": "error",
|
|
82
|
-
// "new-parens": "error",
|
|
83
|
-
// "newline-per-chained-call": ["error", { ignoreChainWithDepth: 3 }], // *
|
|
84
|
-
// "no-irregular-whitespace": "error",
|
|
85
|
-
// "no-lonely-if": "error",
|
|
86
|
-
// "no-multiple-empty-lines": ["error", { max: 2, maxEOF: 0 }],
|
|
87
|
-
// "no-negated-condition": "error",
|
|
88
|
-
// "no-nested-ternary": "error",
|
|
89
|
-
// "no-unneeded-ternary": "error",
|
|
90
|
-
// "no-trailing-spaces": [
|
|
91
|
-
// "error",
|
|
92
|
-
// { skipBlankLines: false, ignoreComments: false },
|
|
93
|
-
// ],
|
|
94
|
-
// "no-whitespace-before-property": "error",
|
|
95
|
-
// "object-curly-spacing": ["error", "always"],
|
|
96
|
-
// "object-curly-newline": [
|
|
97
|
-
// "error",
|
|
98
|
-
// {
|
|
99
|
-
// ObjectExpression: {
|
|
100
|
-
// minProperties: 4,
|
|
101
|
-
// multiline: true,
|
|
102
|
-
// consistent: true,
|
|
103
|
-
// },
|
|
104
|
-
// ObjectPattern: { minProperties: 4, multiline: true, consistent: true },
|
|
105
|
-
// ImportDeclaration: {
|
|
106
|
-
// minProperties: 4,
|
|
107
|
-
// multiline: true,
|
|
108
|
-
// consistent: true,
|
|
109
|
-
// },
|
|
110
|
-
// ExportDeclaration: {
|
|
111
|
-
// minProperties: 4,
|
|
112
|
-
// multiline: true,
|
|
113
|
-
// consistent: true,
|
|
114
|
-
// },
|
|
115
|
-
// },
|
|
116
|
-
// ],
|
|
117
|
-
// "object-property-newline": ["error", { allowAllPropertiesOnSameLine: true }],
|
|
118
|
-
// "padded-blocks": ["error", "never"],
|
|
119
|
-
// "padding-line-between-statements": [
|
|
120
|
-
// "error",
|
|
121
|
-
// { blankLine: "always", prev: "*", next: "block-like" },
|
|
122
|
-
// { blankLine: "always", prev: "block-like", next: "*" },
|
|
123
|
-
// { blankLine: "always", prev: "multiline-expression", next: "*" },
|
|
124
|
-
// { blankLine: "always", prev: ["const", "let", "var"], next: "*" },
|
|
125
|
-
// { blankLine: "always", prev: "*", next: ["const", "let", "var"] },
|
|
126
|
-
// {
|
|
127
|
-
// blankLine: "any",
|
|
128
|
-
// prev: ["const", "let", "var"],
|
|
129
|
-
// next: ["const", "let", "var"],
|
|
130
|
-
// },
|
|
131
|
-
// { blankLine: "always", prev: "*", next: "export" },
|
|
132
|
-
// { blankLine: "always", prev: "import", next: "*" },
|
|
133
|
-
// { blankLine: "any", prev: "import", next: "import" },
|
|
134
|
-
// { blankLine: "always", prev: "class", next: "*" },
|
|
135
|
-
// { blankLine: "always", prev: ["case", "default"], next: "*" },
|
|
136
|
-
// ],
|
|
137
|
-
// semi: ["error", "always"],
|
|
138
|
-
// "semi-spacing": ["error", { before: false, after: true }],
|
|
139
|
-
// "semi-style": ["error", "last"],
|
|
140
|
-
// "space-before-blocks": "error",
|
|
141
|
-
// "space-in-parens": ["error", "never"],
|
|
142
|
-
// "space-before-function-paren": [
|
|
143
|
-
// "error",
|
|
144
|
-
// { anonymous: "always", named: "never", asyncArrow: "always" },
|
|
145
|
-
// ],
|
|
146
|
-
// "space-unary-ops": ["error", { words: true, nonwords: false }],
|
|
147
|
-
// quotes: ["error", "single", { avoidEscape: true }],
|
|
148
|
-
},
|
|
149
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = {
|
|
4
|
+
env: {
|
|
5
|
+
browser: true,
|
|
6
|
+
es6: true,
|
|
7
|
+
node: true,
|
|
8
|
+
},
|
|
9
|
+
plugins: ["@typescript-eslint"],
|
|
10
|
+
parser: "@typescript-eslint/parser",
|
|
11
|
+
parserOptions: {
|
|
12
|
+
ecmaVersion: 2021,
|
|
13
|
+
sourceType: "module",
|
|
14
|
+
},
|
|
15
|
+
rules: {
|
|
16
|
+
// "array-callback-return": ["error", { allowImplicit: true }],
|
|
17
|
+
// curly: "error",
|
|
18
|
+
// "dot-notation": ["error", { allowKeywords: true }],
|
|
19
|
+
// "dot-location": ["error", "property"],
|
|
20
|
+
// "max-classes-per-file": ["error", 1],
|
|
21
|
+
"no-console": "error",
|
|
22
|
+
// "no-else-return": ["error", { allowElseIf: true }],
|
|
23
|
+
// "no-empty-function": [
|
|
24
|
+
// "error",
|
|
25
|
+
// { allow: ["arrowFunctions", "functions", "methods"] },
|
|
26
|
+
// ],
|
|
27
|
+
// "no-eval": "error",
|
|
28
|
+
// "no-extra-bind": "error",
|
|
29
|
+
// "no-lone-blocks": "error",
|
|
30
|
+
// "no-multi-spaces": ["error", { ignoreEOLComments: false }],
|
|
31
|
+
// "no-useless-concat": "error",
|
|
32
|
+
// "no-useless-return": "error",
|
|
33
|
+
// yoda: "error",
|
|
34
|
+
// // ES6
|
|
35
|
+
// "arrow-body-style": ["error", "as-needed"],
|
|
36
|
+
// "arrow-parens": ["error", "always"],
|
|
37
|
+
// "arrow-spacing": ["error", { before: true, after: true }],
|
|
38
|
+
// "no-confusing-arrow": ["error", { allowParens: true }],
|
|
39
|
+
// "no-const-assign": "error",
|
|
40
|
+
// "no-dupe-class-members": "error",
|
|
41
|
+
// "no-useless-rename": [
|
|
42
|
+
// "error",
|
|
43
|
+
// { ignoreDestructuring: false, ignoreImport: false, ignoreExport: false },
|
|
44
|
+
// ],
|
|
45
|
+
// "object-shorthand": [
|
|
46
|
+
// "error",
|
|
47
|
+
// "always",
|
|
48
|
+
// { ignoreConstructors: false, avoidQuotes: true },
|
|
49
|
+
// ],
|
|
50
|
+
// "prefer-arrow-callback": [
|
|
51
|
+
// "error",
|
|
52
|
+
// { allowNamedFunctions: false, allowUnboundThis: true },
|
|
53
|
+
// ],
|
|
54
|
+
// "prefer-template": "error",
|
|
55
|
+
// "rest-spread-spacing": ["error", "never"],
|
|
56
|
+
// "template-curly-spacing": "error",
|
|
57
|
+
// // Style
|
|
58
|
+
// "array-bracket-newline": ["error", { multiline: true, minItems: 4 }],
|
|
59
|
+
// "array-element-newline": ["error", { multiline: true, minItems: 4 }],
|
|
60
|
+
// "array-bracket-spacing": ["error", "never"],
|
|
61
|
+
// "block-spacing": ["error", "always"],
|
|
62
|
+
// "brace-style": ["error", "1tbs", { allowSingleLine: true }],
|
|
63
|
+
// camelcase: [
|
|
64
|
+
// "error",
|
|
65
|
+
// {
|
|
66
|
+
// ignoreDestructuring: true,
|
|
67
|
+
// properties: "never",
|
|
68
|
+
// allow: ["non_field_errors"],
|
|
69
|
+
// },
|
|
70
|
+
// ],
|
|
71
|
+
// "comma-spacing": ["error", { before: false, after: true }],
|
|
72
|
+
// "eol-last": ["error", "always"],
|
|
73
|
+
// "func-call-spacing": ["error", "never"],
|
|
74
|
+
// "func-names": "warn",
|
|
75
|
+
// "function-paren-newline": ["error", "consistent"],
|
|
76
|
+
// indent: ["error", 2, { ignoredNodes: ["TemplateLiteral *"] }],
|
|
77
|
+
// "key-spacing": ["error", { beforeColon: false, afterColon: true }],
|
|
78
|
+
// "keyword-spacing": ["error", { before: true, after: true }],
|
|
79
|
+
// "lines-between-class-members": ["error", "always"],
|
|
80
|
+
// "max-len": ["error", { code: 125, ignoreUrls: true }],
|
|
81
|
+
// "new-cap": "error",
|
|
82
|
+
// "new-parens": "error",
|
|
83
|
+
// "newline-per-chained-call": ["error", { ignoreChainWithDepth: 3 }], // *
|
|
84
|
+
// "no-irregular-whitespace": "error",
|
|
85
|
+
// "no-lonely-if": "error",
|
|
86
|
+
// "no-multiple-empty-lines": ["error", { max: 2, maxEOF: 0 }],
|
|
87
|
+
// "no-negated-condition": "error",
|
|
88
|
+
// "no-nested-ternary": "error",
|
|
89
|
+
// "no-unneeded-ternary": "error",
|
|
90
|
+
// "no-trailing-spaces": [
|
|
91
|
+
// "error",
|
|
92
|
+
// { skipBlankLines: false, ignoreComments: false },
|
|
93
|
+
// ],
|
|
94
|
+
// "no-whitespace-before-property": "error",
|
|
95
|
+
// "object-curly-spacing": ["error", "always"],
|
|
96
|
+
// "object-curly-newline": [
|
|
97
|
+
// "error",
|
|
98
|
+
// {
|
|
99
|
+
// ObjectExpression: {
|
|
100
|
+
// minProperties: 4,
|
|
101
|
+
// multiline: true,
|
|
102
|
+
// consistent: true,
|
|
103
|
+
// },
|
|
104
|
+
// ObjectPattern: { minProperties: 4, multiline: true, consistent: true },
|
|
105
|
+
// ImportDeclaration: {
|
|
106
|
+
// minProperties: 4,
|
|
107
|
+
// multiline: true,
|
|
108
|
+
// consistent: true,
|
|
109
|
+
// },
|
|
110
|
+
// ExportDeclaration: {
|
|
111
|
+
// minProperties: 4,
|
|
112
|
+
// multiline: true,
|
|
113
|
+
// consistent: true,
|
|
114
|
+
// },
|
|
115
|
+
// },
|
|
116
|
+
// ],
|
|
117
|
+
// "object-property-newline": ["error", { allowAllPropertiesOnSameLine: true }],
|
|
118
|
+
// "padded-blocks": ["error", "never"],
|
|
119
|
+
// "padding-line-between-statements": [
|
|
120
|
+
// "error",
|
|
121
|
+
// { blankLine: "always", prev: "*", next: "block-like" },
|
|
122
|
+
// { blankLine: "always", prev: "block-like", next: "*" },
|
|
123
|
+
// { blankLine: "always", prev: "multiline-expression", next: "*" },
|
|
124
|
+
// { blankLine: "always", prev: ["const", "let", "var"], next: "*" },
|
|
125
|
+
// { blankLine: "always", prev: "*", next: ["const", "let", "var"] },
|
|
126
|
+
// {
|
|
127
|
+
// blankLine: "any",
|
|
128
|
+
// prev: ["const", "let", "var"],
|
|
129
|
+
// next: ["const", "let", "var"],
|
|
130
|
+
// },
|
|
131
|
+
// { blankLine: "always", prev: "*", next: "export" },
|
|
132
|
+
// { blankLine: "always", prev: "import", next: "*" },
|
|
133
|
+
// { blankLine: "any", prev: "import", next: "import" },
|
|
134
|
+
// { blankLine: "always", prev: "class", next: "*" },
|
|
135
|
+
// { blankLine: "always", prev: ["case", "default"], next: "*" },
|
|
136
|
+
// ],
|
|
137
|
+
// semi: ["error", "always"],
|
|
138
|
+
// "semi-spacing": ["error", { before: false, after: true }],
|
|
139
|
+
// "semi-style": ["error", "last"],
|
|
140
|
+
// "space-before-blocks": "error",
|
|
141
|
+
// "space-in-parens": ["error", "never"],
|
|
142
|
+
// "space-before-function-paren": [
|
|
143
|
+
// "error",
|
|
144
|
+
// { anonymous: "always", named: "never", asyncArrow: "always" },
|
|
145
|
+
// ],
|
|
146
|
+
// "space-unary-ops": ["error", { words: true, nonwords: false }],
|
|
147
|
+
// quotes: ["error", "single", { avoidEscape: true }],
|
|
148
|
+
},
|
|
149
|
+
};
|
package/dist/rules/index.js
CHANGED
|
@@ -12,6 +12,7 @@ const skip_trailing_slash_redirect_1 = __importDefault(require("./skip-trailing-
|
|
|
12
12
|
const check_locale_1 = __importDefault(require("./check-locale"));
|
|
13
13
|
const meta_data_import_1 = __importDefault(require("./meta-data-import"));
|
|
14
14
|
const check_middleware_order_1 = __importDefault(require("./check-middleware-order"));
|
|
15
|
+
const urls_without_slash_1 = __importDefault(require("./urls-without-slash"));
|
|
15
16
|
const rules = {
|
|
16
17
|
'client-url': client_url_1.default,
|
|
17
18
|
'image-import': image_import_1.default,
|
|
@@ -20,6 +21,7 @@ const rules = {
|
|
|
20
21
|
'skip-trailing-slash-redirect': skip_trailing_slash_redirect_1.default,
|
|
21
22
|
'check-locale': check_locale_1.default,
|
|
22
23
|
'meta-data-import': meta_data_import_1.default,
|
|
23
|
-
'check-middleware-order': check_middleware_order_1.default
|
|
24
|
+
'check-middleware-order': check_middleware_order_1.default,
|
|
25
|
+
'urls-without-slash': urls_without_slash_1.default
|
|
24
26
|
};
|
|
25
27
|
exports.rules = rules;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const utils_1 = require("@typescript-eslint/utils");
|
|
4
|
+
const URLS = [
|
|
5
|
+
'/users/logout/'
|
|
6
|
+
];
|
|
7
|
+
exports.default = utils_1.ESLintUtils.RuleCreator.withoutDocs({
|
|
8
|
+
create(context) {
|
|
9
|
+
if (!context.getFilename().includes('urls.ts')) {
|
|
10
|
+
return {};
|
|
11
|
+
}
|
|
12
|
+
return {
|
|
13
|
+
Literal(node) {
|
|
14
|
+
var _a;
|
|
15
|
+
const value = (_a = node.value) === null || _a === void 0 ? void 0 : _a.toString();
|
|
16
|
+
if (!value) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
URLS.map((url) => {
|
|
20
|
+
if (value.endsWith(url)) {
|
|
21
|
+
context.report({
|
|
22
|
+
messageId: 'UrlWithoutSlash',
|
|
23
|
+
node,
|
|
24
|
+
fix: (fixer) => fixer.replaceText(node, `\`${value.slice(0, -1)}\``)
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
},
|
|
31
|
+
meta: {
|
|
32
|
+
messages: {
|
|
33
|
+
UrlWithoutSlash: 'It must not end with a forward slash (/).'
|
|
34
|
+
},
|
|
35
|
+
type: 'problem',
|
|
36
|
+
fixable: 'code',
|
|
37
|
+
schema: []
|
|
38
|
+
},
|
|
39
|
+
defaultOptions: []
|
|
40
|
+
});
|
package/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./rules";
|
|
2
|
-
export * as configs from "./configs";
|
|
1
|
+
export * from "./rules";
|
|
2
|
+
export * as configs from "./configs";
|