@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 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: "off",
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: "readonly",
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": 2,
80
- "dot-notation": 0,
81
- eqeqeq: [2, "allow-null"],
82
- "guard-for-in": 2,
83
- "no-alert": 2,
84
- "no-bitwise": 2,
85
- "no-caller": 2,
86
- "no-cond-assign": 0,
87
- "no-console": 2,
88
- "no-debugger": 2,
89
- "no-empty": 0,
90
- "no-eval": 2,
91
- "no-extend-native": 2,
92
- "no-extra-parens": 0,
93
- "no-inner-declarations": 2,
94
- "no-irregular-whitespace": 2,
95
- "no-iterator": 2,
96
- "no-loop-func": 2,
97
- "no-mixed-spaces-and-tabs": 2,
98
- "no-multi-str": 2,
99
- "no-new": 2,
100
- "no-plusplus": 0,
101
- "no-proto": 2,
102
- "no-script-url": 2,
103
- "no-sequences": 2,
104
- "no-shadow": 2,
105
- "no-this-before-super": 2,
106
- "no-trailing-spaces": 2,
107
- "no-undef": 2,
108
- "no-unused-vars": 2,
109
- "no-with": 2,
110
- "no-var": 2,
111
- radix: 2,
112
- semi: 2,
113
- strict: 0,
114
- "valid-typeof": 2,
115
- "wrap-iife": [2, "inside"],
116
- curly: 2,
117
- "no-duplicate-imports": 2,
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": 2,
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
- 2,
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.0.0",
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/eslint-config-discourse.git"
12
+ "url": "git+https://github.com/discourse/lint-configs.git"
13
13
  },
14
- "homepage": "https://github.com/discourse/eslint-config-discourse#readme",
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.2",
36
- "@babel/eslint-parser": "^7.22.15",
37
- "@babel/plugin-proposal-decorators": "^7.23.2",
38
- "ember-template-lint": "^5.11.2",
39
- "eslint": "^8.51.0",
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.11.2",
50
- "eslint": "^8.51.0",
49
+ "ember-template-lint": "^5.13.0",
50
+ "eslint": "^8.54.0",
51
51
  "prettier": "^2.8.8"
52
52
  }
53
53
  }
@@ -1,33 +1,46 @@
1
1
  module.exports = {
2
2
  extends: ["recommended", "stylistic"],
3
3
  rules: {
4
- "no-positive-tabindex": false,
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
- // GJS compatibility
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
- "require-input-label": false,
18
+ "no-link-to-tagname": false,
19
+ "no-passed-in-event-handlers": false,
24
20
  "no-route-action": false,
25
- "no-action": false,
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
  };