@discourse/lint-configs 1.0.0 → 1.2.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/README.md +31 -0
- package/eslintrc.cjs +95 -44
- package/package.json +10 -10
- package/template-lint.config.cjs +29 -16
package/README.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# @discourse/lint-configs
|
|
2
|
+
|
|
3
|
+
Shareable lint configs for Discourse core, plugins, and themes
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
Add `@discourse/lint-configs` to package.json, and create these three files:
|
|
8
|
+
|
|
9
|
+
### .eslintrc.cjs
|
|
10
|
+
|
|
11
|
+
```js
|
|
12
|
+
module.exports = require("@discourse/lint-configs/eslint");
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
or in themes/theme components:
|
|
16
|
+
|
|
17
|
+
```js
|
|
18
|
+
module.exports = require("@discourse/lint-configs/eslint-theme");
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### .prettierrc.cjs
|
|
22
|
+
|
|
23
|
+
```js
|
|
24
|
+
module.exports = require("@discourse/lint-configs/prettier");
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### .template-lintrc.cjs
|
|
28
|
+
|
|
29
|
+
```js
|
|
30
|
+
module.exports = require("@discourse/lint-configs/template-lint");
|
|
31
|
+
```
|
package/eslintrc.cjs
CHANGED
|
@@ -7,6 +7,7 @@ const TEMPLATE_TAG_PLACEHOLDER = "__GLIMMER_TEMPLATE";
|
|
|
7
7
|
|
|
8
8
|
module.exports = {
|
|
9
9
|
root: true,
|
|
10
|
+
extends: "eslint:recommended",
|
|
10
11
|
parser: "@babel/eslint-parser",
|
|
11
12
|
env: {
|
|
12
13
|
browser: true,
|
|
@@ -30,7 +31,7 @@ module.exports = {
|
|
|
30
31
|
],
|
|
31
32
|
globals: {
|
|
32
33
|
_: "off",
|
|
33
|
-
$: "readonly",
|
|
34
|
+
$: "readonly", // covered by ember/no-global-jquery
|
|
34
35
|
acceptance: "off",
|
|
35
36
|
asyncRender: "off",
|
|
36
37
|
Blob: "readonly",
|
|
@@ -52,12 +53,12 @@ module.exports = {
|
|
|
52
53
|
globalThis: "readonly",
|
|
53
54
|
hasModule: "off",
|
|
54
55
|
invisible: "off",
|
|
55
|
-
jQuery: "
|
|
56
|
+
jQuery: "readonly", // covered by ember/no-global-jquery
|
|
56
57
|
keyboardHelper: "off",
|
|
57
58
|
keyEvent: "off",
|
|
58
59
|
moduleFor: "off",
|
|
59
60
|
moment: "readonly",
|
|
60
|
-
pauseTest: "
|
|
61
|
+
pauseTest: "off",
|
|
61
62
|
Pretender: "off",
|
|
62
63
|
Promise: "readonly",
|
|
63
64
|
query: "off",
|
|
@@ -76,49 +77,99 @@ module.exports = {
|
|
|
76
77
|
waitUntil: "off",
|
|
77
78
|
},
|
|
78
79
|
rules: {
|
|
79
|
-
"block-scoped-var":
|
|
80
|
-
"
|
|
81
|
-
|
|
82
|
-
"guard-for-in":
|
|
83
|
-
"no-alert":
|
|
84
|
-
"no-bitwise":
|
|
85
|
-
"no-caller":
|
|
86
|
-
"no-
|
|
87
|
-
"no-
|
|
88
|
-
"no-
|
|
89
|
-
"no-
|
|
90
|
-
"no-
|
|
91
|
-
"no-
|
|
92
|
-
"no-
|
|
93
|
-
"no-
|
|
94
|
-
"no-
|
|
95
|
-
"no-
|
|
96
|
-
"no-
|
|
97
|
-
"no-
|
|
98
|
-
"no-
|
|
99
|
-
"no-
|
|
100
|
-
"no-
|
|
101
|
-
"no-
|
|
102
|
-
"no-
|
|
103
|
-
"no-
|
|
104
|
-
"no-
|
|
105
|
-
"no-
|
|
106
|
-
"no-
|
|
107
|
-
"no-
|
|
108
|
-
"no-
|
|
109
|
-
"no-
|
|
110
|
-
"no-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
"
|
|
115
|
-
"
|
|
116
|
-
|
|
117
|
-
"
|
|
80
|
+
"block-scoped-var": "error",
|
|
81
|
+
eqeqeq: ["error", "allow-null"],
|
|
82
|
+
"getter-return": "off",
|
|
83
|
+
"guard-for-in": "error",
|
|
84
|
+
"no-alert": "error",
|
|
85
|
+
"no-bitwise": "error",
|
|
86
|
+
"no-caller": "error",
|
|
87
|
+
"no-case-declarations": "off",
|
|
88
|
+
"no-cond-assign": "off",
|
|
89
|
+
"no-console": "error",
|
|
90
|
+
"no-constant-condition": "off",
|
|
91
|
+
"no-control-regex": "off",
|
|
92
|
+
"no-debugger": "error",
|
|
93
|
+
"no-empty": ["error", { allowEmptyCatch: true }],
|
|
94
|
+
"no-eval": "error",
|
|
95
|
+
"no-extend-native": "error",
|
|
96
|
+
"no-inner-declarations": "error",
|
|
97
|
+
"no-irregular-whitespace": "error",
|
|
98
|
+
"no-iterator": "error",
|
|
99
|
+
"no-loop-func": "error",
|
|
100
|
+
"no-misleading-character-class": "off",
|
|
101
|
+
"no-mixed-spaces-and-tabs": "error",
|
|
102
|
+
"no-multi-str": "error",
|
|
103
|
+
"no-new": "error",
|
|
104
|
+
"no-proto": "error",
|
|
105
|
+
"no-prototype-builtins": "off",
|
|
106
|
+
"no-regex-spaces": "off",
|
|
107
|
+
"no-script-url": "error",
|
|
108
|
+
"no-sequences": "error",
|
|
109
|
+
"no-shadow": "error",
|
|
110
|
+
"no-this-before-super": "error",
|
|
111
|
+
"no-trailing-spaces": "error",
|
|
112
|
+
"no-undef": "error",
|
|
113
|
+
"no-unexpected-multiline": "off",
|
|
114
|
+
"no-unused-vars": "error",
|
|
115
|
+
"no-useless-escape": "off",
|
|
116
|
+
"no-var": "error",
|
|
117
|
+
"no-with": "error",
|
|
118
|
+
radix: "error",
|
|
119
|
+
semi: "error",
|
|
120
|
+
"valid-typeof": "error",
|
|
121
|
+
"wrap-iife": ["error", "inside"],
|
|
122
|
+
curly: "error",
|
|
123
|
+
"no-duplicate-imports": "error",
|
|
118
124
|
"object-shorthand": ["error", "properties"],
|
|
119
|
-
"no-dupe-class-members":
|
|
125
|
+
"no-dupe-class-members": "error",
|
|
126
|
+
"ember/no-attrs-in-components": "error",
|
|
127
|
+
"ember/no-attrs-snapshot": "error",
|
|
128
|
+
"ember/no-arrow-function-computed-properties": "off",
|
|
129
|
+
"ember/no-assignment-of-untracked-properties-used-in-tracking-contexts":
|
|
130
|
+
"off",
|
|
131
|
+
"ember/no-duplicate-dependent-keys": "error",
|
|
132
|
+
"ember/no-side-effects": "off",
|
|
133
|
+
"ember/no-volatile-computed-properties": "error",
|
|
134
|
+
"ember/require-return-from-computed": "off",
|
|
135
|
+
"ember/avoid-using-needs-in-controllers": "error",
|
|
136
|
+
"ember/new-module-imports": "error",
|
|
137
|
+
"ember/no-deprecated-router-transition-methods": "error",
|
|
138
|
+
"ember/no-function-prototype-extensions": "error",
|
|
139
|
+
"ember/no-string-prototype-extensions": "error",
|
|
140
|
+
"ember/avoid-leaking-state-in-ember-objects": "off",
|
|
141
|
+
"ember/no-get": "off",
|
|
142
|
+
"ember/no-observers": "off",
|
|
143
|
+
"ember/no-mixins": "off",
|
|
144
|
+
"ember/no-new-mixins": "off",
|
|
145
|
+
"ember/no-implicit-injections": "off",
|
|
146
|
+
"ember/no-array-prototype-extensions": "off",
|
|
147
|
+
"ember/no-try-invoke": "error",
|
|
148
|
+
"ember/require-super-in-lifecycle-hooks": "error",
|
|
149
|
+
"ember/classic-decorator-hooks": "off",
|
|
150
|
+
"ember/no-actions-hash": "off",
|
|
151
|
+
"ember/no-classic-classes": "off",
|
|
152
|
+
"ember/no-ember-super-in-es-classes": "error",
|
|
153
|
+
"ember/no-empty-glimmer-component-classes": "error",
|
|
154
|
+
"ember/no-global-jquery": "error",
|
|
155
|
+
"ember/no-jquery": "off",
|
|
156
|
+
"ember/no-incorrect-calls-with-inline-anonymous-functions": "error",
|
|
157
|
+
"ember/no-invalid-debug-function-arguments": "error",
|
|
158
|
+
"ember/no-capital-letters-in-routes": "off",
|
|
159
|
+
"ember/no-controller-access-in-routes": "off",
|
|
160
|
+
"ember/no-private-routing-service": "error",
|
|
161
|
+
"ember/no-shadow-route-definition": "off",
|
|
162
|
+
"ember/no-unnecessary-index-route": "off",
|
|
163
|
+
"ember/no-unnecessary-route-path-option": "error",
|
|
164
|
+
"ember/route-path-style": "off",
|
|
165
|
+
"ember/routes-segments-snake-case": "off",
|
|
166
|
+
"ember/no-pause-test": "error",
|
|
167
|
+
"ember/no-replace-test-comments": "error",
|
|
168
|
+
"ember/no-settled-after-test-helper": "error",
|
|
169
|
+
"ember/prefer-ember-test-helpers": "error",
|
|
170
|
+
"ember/require-valid-css-selector-in-test-helpers": "error",
|
|
120
171
|
"sort-class-members/sort-class-members": [
|
|
121
|
-
|
|
172
|
+
"error",
|
|
122
173
|
{
|
|
123
174
|
order: [
|
|
124
175
|
"[static-properties]",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@discourse/lint-configs",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Shareable lint configs for Discourse core, plugins, and themes",
|
|
5
5
|
"author": "Discourse",
|
|
6
6
|
"license": "MIT",
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
],
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
12
|
-
"url": "git+https://github.com/discourse/
|
|
12
|
+
"url": "git+https://github.com/discourse/lint-configs.git"
|
|
13
13
|
},
|
|
14
|
-
"homepage": "https://github.com/discourse/
|
|
14
|
+
"homepage": "https://github.com/discourse/lint-configs#readme",
|
|
15
15
|
"type": "module",
|
|
16
16
|
"exports": {
|
|
17
17
|
"./eslint": {
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
"test": "cd ../test && node test.js"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@babel/core": "^7.23.
|
|
36
|
-
"@babel/eslint-parser": "^7.
|
|
37
|
-
"@babel/plugin-proposal-decorators": "^7.23.
|
|
38
|
-
"ember-template-lint": "^5.
|
|
39
|
-
"eslint": "^8.
|
|
35
|
+
"@babel/core": "^7.23.5",
|
|
36
|
+
"@babel/eslint-parser": "^7.23.3",
|
|
37
|
+
"@babel/plugin-proposal-decorators": "^7.23.5",
|
|
38
|
+
"ember-template-lint": "^5.13.0",
|
|
39
|
+
"eslint": "^8.54.0",
|
|
40
40
|
"eslint-plugin-decorator-position": "^5.0.2",
|
|
41
41
|
"eslint-plugin-ember": "^11.11.1",
|
|
42
42
|
"eslint-plugin-simple-import-sort": "^10.0.0",
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
"prettier-plugin-ember-template-tag": "^0.3.2"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"ember-template-lint": "^5.
|
|
50
|
-
"eslint": "^8.
|
|
49
|
+
"ember-template-lint": "^5.13.0",
|
|
50
|
+
"eslint": "^8.54.0",
|
|
51
51
|
"prettier": "^2.8.8"
|
|
52
52
|
}
|
|
53
53
|
}
|
package/template-lint.config.cjs
CHANGED
|
@@ -1,33 +1,46 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
extends: ["recommended", "stylistic"],
|
|
3
3
|
rules: {
|
|
4
|
-
|
|
4
|
+
// Intentionally disabled default rules
|
|
5
5
|
"no-autofocus-attribute": false,
|
|
6
|
+
"no-positive-tabindex": false,
|
|
6
7
|
"require-mandatory-role-attributes": false,
|
|
7
8
|
"require-media-caption": false,
|
|
8
9
|
|
|
9
|
-
//
|
|
10
|
-
"modifier-name-case": false,
|
|
11
|
-
|
|
12
|
-
// Pending
|
|
13
|
-
"require-presentational-children": false,
|
|
14
|
-
"no-duplicate-landmark-elements": false,
|
|
15
|
-
"no-passed-in-event-handlers": false,
|
|
16
|
-
"no-inline-styles": false,
|
|
17
|
-
"no-link-to-tagname": false,
|
|
18
|
-
"no-implicit-this": false,
|
|
19
|
-
"require-valid-alt-text": false,
|
|
10
|
+
// Pending default rules
|
|
20
11
|
"link-href-attributes": false,
|
|
12
|
+
"no-action": false,
|
|
21
13
|
"no-curly-component-invocation": false,
|
|
14
|
+
"no-duplicate-landmark-elements": false,
|
|
15
|
+
"no-implicit-this": false,
|
|
16
|
+
"no-inline-styles": false,
|
|
22
17
|
"no-link-to-positional-params": false,
|
|
23
|
-
"
|
|
18
|
+
"no-link-to-tagname": false,
|
|
19
|
+
"no-passed-in-event-handlers": false,
|
|
24
20
|
"no-route-action": false,
|
|
25
|
-
"
|
|
21
|
+
"require-input-label": false,
|
|
22
|
+
"require-presentational-children": false,
|
|
23
|
+
"require-valid-alt-text": false,
|
|
24
|
+
|
|
25
|
+
// Non-default rules
|
|
26
|
+
"no-unnecessary-curly-parens": true,
|
|
27
|
+
"no-unnecessary-curly-strings": true,
|
|
28
|
+
"simple-modifiers": true,
|
|
29
|
+
|
|
30
|
+
// Pending non-default rules
|
|
31
|
+
"attribute-order": false,
|
|
32
|
+
"inline-link-to": false,
|
|
33
|
+
"no-action-modifiers": false,
|
|
34
|
+
"no-builtin-form-components": false,
|
|
35
|
+
"no-this-in-template-only-components": false, // emits false-positives in gjs
|
|
36
|
+
|
|
37
|
+
// GJS compatibility
|
|
38
|
+
"modifier-name-case": false,
|
|
26
39
|
|
|
27
40
|
// Prettier compatibility
|
|
28
|
-
"eol-last": false,
|
|
29
|
-
"self-closing-void-elements": false,
|
|
30
41
|
"block-indentation": false,
|
|
42
|
+
"eol-last": false,
|
|
31
43
|
quotes: false,
|
|
44
|
+
"self-closing-void-elements": false,
|
|
32
45
|
},
|
|
33
46
|
};
|