eslint-config-brightspace 0.25.3 → 1.0.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 +19 -67
- package/browser-config.js +1 -1
- package/index.js +39 -1
- package/lit-config.js +5 -0
- package/node-config.js +5 -2
- package/package.json +2 -9
- package/{open-wc-testing-config.js → testing-config.js} +2 -3
- package/common-config.js +0 -41
- package/polymer-3-config.js +0 -12
- package/polymer-config.js +0 -12
- package/polymer-sort-member-config.js +0 -22
- package/wct-config.js +0 -17
- package/wct-lit-config.js +0 -20
- package/wct-polymer-3-config.js +0 -17
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# eslint-config-brightspace
|
|
2
|
-
|
|
3
|
-
[](https://npmjs.org/package/eslint-config-brightspace-url)
|
|
4
4
|
|
|
5
5
|
Common Brightspace eslint configs.
|
|
6
6
|
|
|
@@ -12,88 +12,40 @@ npm install eslint-config-brightspace
|
|
|
12
12
|
|
|
13
13
|
## Usage
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
### Default Config
|
|
18
|
-
|
|
19
|
-
Specify the `extends` property in the `.eslintrc.json` file:
|
|
15
|
+
Set the `extends` property in the `.eslintrc.json` file, replacing `<environment>` with the desired environment-specific config.
|
|
20
16
|
|
|
21
17
|
```json
|
|
22
18
|
{
|
|
23
|
-
"extends": "brightspace"
|
|
19
|
+
"extends": "brightspace/<environment>"
|
|
24
20
|
}
|
|
25
21
|
```
|
|
26
22
|
|
|
27
23
|
### Environment Specific Configs
|
|
28
24
|
|
|
29
|
-
|
|
25
|
+
| Environment | Description |
|
|
26
|
+
|--|--|
|
|
27
|
+
| `browser-config` | use with code that runs in a browser |
|
|
28
|
+
| `lit-config` | use with [Lit](https://lit.dev/) projects |
|
|
29
|
+
| `testing-config` | use with [@brightspace-ui/testing](https://github.com/BrightspaceUI/testing) test code |
|
|
30
|
+
| `node-config` | use with [Node.js](https://nodejs.org) projects |
|
|
31
|
+
| `react-config` | use with [React](https://react.dev/) projects |
|
|
30
32
|
|
|
31
|
-
|
|
32
|
-
* `lit-config` : sets up env for browser globals and lit rules for lit elements
|
|
33
|
-
* `node-config` : sets up node globals including es6 env features
|
|
34
|
-
* `react-config` : sets up env for jsx and es6, including globals for jest
|
|
35
|
-
* `open-wc-testing-config` : sets up env for [@open-wc/testing](https://open-wc.org/testing)
|
|
36
|
-
* `polymer-config` : sets up env for browser globals and polymer web components
|
|
37
|
-
* `polymer-3-config` : sets up env for browser globals and polymer web components for polymer 3
|
|
38
|
-
* `wct-config` : sets up env for web component tester tests
|
|
39
|
-
* `wct-polymer-3-config` : sets up env for web component tester tests for polymer 3
|
|
33
|
+
Example:
|
|
40
34
|
|
|
41
35
|
```json
|
|
42
36
|
{
|
|
43
|
-
"extends": "brightspace/
|
|
37
|
+
"extends": "brightspace/lit-config"
|
|
44
38
|
}
|
|
45
39
|
```
|
|
46
40
|
|
|
47
|
-
See the [eslint rules](
|
|
48
|
-
|
|
49
|
-
## Contributing
|
|
50
|
-
|
|
51
|
-
Contributions are welcome, please submit a pull request!
|
|
52
|
-
|
|
53
|
-
### Code Style
|
|
54
|
-
|
|
55
|
-
This repository is configured with [EditorConfig](http://editorconfig.org) rules and contributions should make use of them.
|
|
56
|
-
|
|
57
|
-
## Versioning & Releasing
|
|
58
|
-
|
|
59
|
-
> TL;DR: Commits prefixed with `fix:` and `feat:` will trigger patch and minor releases when merged to `main`. Read on for more details...
|
|
60
|
-
|
|
61
|
-
The [semantic-release GitHub Action](https://github.com/BrightspaceUI/actions/tree/main/semantic-release) is called from the `release.yml` GitHub Action workflow to handle version changes and releasing.
|
|
62
|
-
|
|
63
|
-
### Version Changes
|
|
64
|
-
|
|
65
|
-
All version changes should obey [semantic versioning](https://semver.org/) rules:
|
|
66
|
-
1. **MAJOR** version when you make incompatible API changes,
|
|
67
|
-
2. **MINOR** version when you add functionality in a backwards compatible manner, and
|
|
68
|
-
3. **PATCH** version when you make backwards compatible bug fixes.
|
|
69
|
-
|
|
70
|
-
The next version number will be determined from the commit messages since the previous release. Our semantic-release configuration uses the [Angular convention](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular) when analyzing commits:
|
|
71
|
-
* Commits which are prefixed with `fix:` or `perf:` will trigger a `patch` release. Example: `fix: validate input before using`
|
|
72
|
-
* Commits which are prefixed with `feat:` will trigger a `minor` release. Example: `feat: add toggle() method`
|
|
73
|
-
* To trigger a MAJOR release, include `BREAKING CHANGE:` with a space or two newlines in the footer of the commit message
|
|
74
|
-
* Other suggested prefixes which will **NOT** trigger a release: `build:`, `ci:`, `docs:`, `style:`, `refactor:` and `test:`. Example: `docs: adding README for new component`
|
|
75
|
-
|
|
76
|
-
To revert a change, add the `revert:` prefix to the original commit message. This will cause the reverted change to be omitted from the release notes. Example: `revert: fix: validate input before using`.
|
|
77
|
-
|
|
78
|
-
### Releases
|
|
79
|
-
|
|
80
|
-
When a release is triggered, it will:
|
|
81
|
-
* Update the version in `package.json`
|
|
82
|
-
* Tag the commit
|
|
83
|
-
* Create a GitHub release (including release notes)
|
|
84
|
-
* Deploy a new package to NPM
|
|
41
|
+
See the [eslint rules](https://eslint.org/docs/latest/rules/) for more details on rule configuration. See the [eslint shareable configs](https://eslint.org/docs/latest/extend/shareable-configs.html) for more details on creating configs.
|
|
85
42
|
|
|
86
|
-
|
|
43
|
+
## Developing and Contributing
|
|
87
44
|
|
|
88
|
-
|
|
45
|
+
After cloning the repo, run `npm install` to install dependencies.
|
|
89
46
|
|
|
90
|
-
|
|
47
|
+
### Versioning and Releasing
|
|
91
48
|
|
|
92
|
-
|
|
93
|
-
* `1.15.x` for patch releases on top of the `1.15` release (after version `1.16` exists)
|
|
94
|
-
* `2.x` for feature releases on top of the `2` release (after version `3` exists)
|
|
49
|
+
This repo is configured to use `semantic-release`. Commits prefixed with `fix:` and `feat:` will trigger patch and minor releases when merged to `main`.
|
|
95
50
|
|
|
96
|
-
[
|
|
97
|
-
[npm-image]: https://img.shields.io/npm/v/eslint-config-brightspace.svg
|
|
98
|
-
[dependencies-url]: https://david-dm.org/brightspace/eslint-config-brightspace
|
|
99
|
-
[dependencies-image]: https://img.shields.io/david/Brightspace/eslint-config-brightspace.svg
|
|
51
|
+
To learn how to create major releases and release from maintenance branches, refer to the [semantic-release GitHub Action](https://github.com/BrightspaceUI/actions/tree/main/semantic-release) documentation.
|
package/browser-config.js
CHANGED
package/index.js
CHANGED
|
@@ -1,3 +1,41 @@
|
|
|
1
|
+
// nr = not as per eslint:recommended
|
|
2
|
+
|
|
1
3
|
module.exports = {
|
|
2
|
-
"extends": ["eslint:recommended",
|
|
4
|
+
"extends": ["eslint:recommended"],
|
|
5
|
+
"rules": {
|
|
6
|
+
"comma-spacing": 2, // nr
|
|
7
|
+
"eol-last": 2, // nr
|
|
8
|
+
"eqeqeq": [2, "always", { "null": "ignore" }], // nr
|
|
9
|
+
"indent": [2, "tab", { "SwitchCase": 1 }], // nr
|
|
10
|
+
"keyword-spacing": 2,
|
|
11
|
+
"linebreak-style": ["error", "unix"], // nr
|
|
12
|
+
"new-parens": 2, // nr
|
|
13
|
+
"no-debugger": 2,
|
|
14
|
+
"no-dupe-args": 2,
|
|
15
|
+
"no-dupe-keys": 2,
|
|
16
|
+
"no-duplicate-case": 2,
|
|
17
|
+
"no-ex-assign": 2,
|
|
18
|
+
"no-fallthrough": 2,
|
|
19
|
+
"no-invalid-this": 2, // nr
|
|
20
|
+
"no-multiple-empty-lines": [2, {"max": 1}], // nr
|
|
21
|
+
"no-multi-spaces": 2, // nr
|
|
22
|
+
"no-new-wrappers": 2, // nr
|
|
23
|
+
"no-trailing-spaces": 2, // nr
|
|
24
|
+
"no-undef": 2,
|
|
25
|
+
"no-unneeded-ternary": 2, // nr
|
|
26
|
+
"no-unreachable": 2,
|
|
27
|
+
"no-unused-vars": [2, {"vars": "all", "args": "after-used"}],
|
|
28
|
+
"no-use-before-define": [2, "nofunc"], // nr
|
|
29
|
+
"no-var": 2, // nr
|
|
30
|
+
"object-curly-spacing": [2, "always"],
|
|
31
|
+
"prefer-const": 2, // nr
|
|
32
|
+
"quotes": [2, "single", "avoid-escape"], // nr
|
|
33
|
+
"semi": 2, // nr
|
|
34
|
+
"space-before-blocks": [2, "always"], // nr
|
|
35
|
+
"space-before-function-paren": [2, "never"], //nr
|
|
36
|
+
"space-in-parens": [2, "never"],
|
|
37
|
+
"space-infix-ops": 2, // nr
|
|
38
|
+
"strict": [2, "global"], // nr
|
|
39
|
+
"valid-typeof": 2
|
|
40
|
+
}
|
|
3
41
|
};
|
package/lit-config.js
CHANGED
|
@@ -52,17 +52,22 @@ module.exports = {
|
|
|
52
52
|
"rules": {
|
|
53
53
|
"lit/attribute-value-entities": 2,
|
|
54
54
|
"lit/binding-positions": 2,
|
|
55
|
+
"lit/lifecycle-super": 2,
|
|
55
56
|
"lit/no-duplicate-template-bindings": 2,
|
|
56
57
|
"lit/no-invalid-escape-sequences": 2,
|
|
57
58
|
"lit/no-invalid-html": 2,
|
|
59
|
+
"lit/no-legacy-imports": 2,
|
|
58
60
|
"lit/no-legacy-template-syntax": 2,
|
|
59
61
|
"lit/no-private-properties": [2, { "private": "^(__|_)" }],
|
|
60
62
|
"lit/no-property-change-update": 2,
|
|
63
|
+
"lit/no-native-attributes": 1,
|
|
61
64
|
"lit/no-template-arrow": 2,
|
|
62
65
|
"lit/no-template-bind": 2,
|
|
63
66
|
"lit/no-template-map": 0,
|
|
67
|
+
"lit/no-this-assign-in-render": 2,
|
|
64
68
|
"lit/no-useless-template-literals": 2,
|
|
65
69
|
"lit/no-value-attribute": 2,
|
|
70
|
+
"lit/prefer-nothing": 2,
|
|
66
71
|
...sortMemberRules
|
|
67
72
|
}
|
|
68
73
|
};
|
package/node-config.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-config-brightspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Common Brightspace eslint configs.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -17,19 +17,12 @@
|
|
|
17
17
|
],
|
|
18
18
|
"files": [
|
|
19
19
|
"browser-config.js",
|
|
20
|
-
"common-config.js",
|
|
21
20
|
"index.js",
|
|
22
21
|
"lit-config.js",
|
|
23
22
|
"node-config.js",
|
|
24
|
-
"open-wc-testing-config.js",
|
|
25
|
-
"polymer-3-config.js",
|
|
26
|
-
"polymer-config.js",
|
|
27
|
-
"polymer-sort-member-config.js",
|
|
28
23
|
"react-config.js",
|
|
29
24
|
"sort-member-config.js",
|
|
30
|
-
"
|
|
31
|
-
"wct-lit-config.js",
|
|
32
|
-
"wct-polymer-3-config.js"
|
|
25
|
+
"testing-config.js"
|
|
33
26
|
],
|
|
34
27
|
"author": "D2L Corporation",
|
|
35
28
|
"license": "Apache-2.0",
|
package/common-config.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
// nr = not as per eslint:recommended
|
|
3
|
-
|
|
4
|
-
module.exports = {
|
|
5
|
-
"rules": {
|
|
6
|
-
"comma-spacing": 2, // nr
|
|
7
|
-
"eol-last": 2, // nr
|
|
8
|
-
"eqeqeq": [2, "always", { "null": "ignore" }], // nr
|
|
9
|
-
"indent": [2, "tab", { "SwitchCase": 1 }], // nr
|
|
10
|
-
"keyword-spacing": 2,
|
|
11
|
-
"linebreak-style": ["error", "unix"], // nr
|
|
12
|
-
"new-parens": 2, // nr
|
|
13
|
-
"no-debugger": 2,
|
|
14
|
-
"no-dupe-args": 2,
|
|
15
|
-
"no-dupe-keys": 2,
|
|
16
|
-
"no-duplicate-case": 2,
|
|
17
|
-
"no-ex-assign": 2,
|
|
18
|
-
"no-fallthrough": 2,
|
|
19
|
-
"no-invalid-this": 2, // nr
|
|
20
|
-
"no-multiple-empty-lines": [2, {"max": 1}], // nr
|
|
21
|
-
"no-multi-spaces": 2, // nr
|
|
22
|
-
"no-new-wrappers": 2, // nr
|
|
23
|
-
"no-trailing-spaces": 2, // nr
|
|
24
|
-
"no-undef": 2,
|
|
25
|
-
"no-unneeded-ternary": 2, // nr
|
|
26
|
-
"no-unreachable": 2,
|
|
27
|
-
"no-unused-vars": [2, {"vars": "all", "args": "after-used"}],
|
|
28
|
-
"no-use-before-define": [2, "nofunc"], // nr
|
|
29
|
-
"no-var": 2, // nr
|
|
30
|
-
"object-curly-spacing": [2, "always"],
|
|
31
|
-
"prefer-const": 2, // nr
|
|
32
|
-
"quotes": [2, "single", "avoid-escape"], // nr
|
|
33
|
-
"semi": 2, // nr
|
|
34
|
-
"space-before-blocks": [2, "always"], // nr
|
|
35
|
-
"space-before-function-paren": [2, "never"], //nr
|
|
36
|
-
"space-in-parens": [2, "never"],
|
|
37
|
-
"space-infix-ops": 2, // nr
|
|
38
|
-
"strict": [2, "global"], // nr
|
|
39
|
-
"valid-typeof": 2
|
|
40
|
-
}
|
|
41
|
-
};
|
package/polymer-3-config.js
DELETED
package/polymer-config.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
const { getSortMemberRules } = require('./sort-member-config');
|
|
2
|
-
|
|
3
|
-
module.exports.sortMemberRules = getSortMemberRules([
|
|
4
|
-
"[static-property-is]",
|
|
5
|
-
"[static-property-properties]",
|
|
6
|
-
"[static-property-styles]",
|
|
7
|
-
"[static-properties]",
|
|
8
|
-
"[static-methods]",
|
|
9
|
-
"[properties]",
|
|
10
|
-
"constructor",
|
|
11
|
-
"[accessor-pairs]",
|
|
12
|
-
"[accessors]",
|
|
13
|
-
"[methods]",
|
|
14
|
-
"[private-accessor-pairs]",
|
|
15
|
-
"[private-accessors]",
|
|
16
|
-
"[private-properties]",
|
|
17
|
-
"[private-methods]"
|
|
18
|
-
], {
|
|
19
|
-
"static-property-is": [{ "name": "is", "static": true }],
|
|
20
|
-
"static-property-properties": [{ "name": "properties", "static": true }],
|
|
21
|
-
"static-property-styles": [{ "name": "styles", "static": true }]
|
|
22
|
-
});
|
package/wct-config.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
"extends": "./polymer-config.js",
|
|
3
|
-
"env": {
|
|
4
|
-
"es6": true,
|
|
5
|
-
"mocha": true
|
|
6
|
-
},
|
|
7
|
-
"globals": {
|
|
8
|
-
"a11ySuite": true,
|
|
9
|
-
"assert": true,
|
|
10
|
-
"fixture": true,
|
|
11
|
-
"flush": true,
|
|
12
|
-
"expect": true,
|
|
13
|
-
"MockInteractions": true,
|
|
14
|
-
"sinon": true,
|
|
15
|
-
"WCT": true
|
|
16
|
-
}
|
|
17
|
-
};
|
package/wct-lit-config.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
"extends": "./lit-config.js",
|
|
3
|
-
"env": {
|
|
4
|
-
"mocha": true,
|
|
5
|
-
"node": true
|
|
6
|
-
},
|
|
7
|
-
"globals": {
|
|
8
|
-
"assert": true,
|
|
9
|
-
"fixture": true,
|
|
10
|
-
"flush": true,
|
|
11
|
-
"expect": true,
|
|
12
|
-
"MockInteractions": true,
|
|
13
|
-
"sinon": true,
|
|
14
|
-
"WCT": true
|
|
15
|
-
},
|
|
16
|
-
"rules": {
|
|
17
|
-
"no-invalid-this": 0,
|
|
18
|
-
"prefer-arrow-callback": 0
|
|
19
|
-
}
|
|
20
|
-
};
|
package/wct-polymer-3-config.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
"extends": "./polymer-3-config.js",
|
|
3
|
-
"env": {
|
|
4
|
-
"es6": true,
|
|
5
|
-
"mocha": true
|
|
6
|
-
},
|
|
7
|
-
"globals": {
|
|
8
|
-
"a11ySuite": true,
|
|
9
|
-
"assert": true,
|
|
10
|
-
"fixture": true,
|
|
11
|
-
"flush": true,
|
|
12
|
-
"expect": true,
|
|
13
|
-
"MockInteractions": true,
|
|
14
|
-
"sinon": true,
|
|
15
|
-
"WCT": true
|
|
16
|
-
}
|
|
17
|
-
};
|