eslint-config-brightspace 1.3.1 → 2.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 CHANGED
@@ -12,30 +12,61 @@ npm install eslint-config-brightspace
12
12
 
13
13
  ## Usage
14
14
 
15
- Set the `extends` property in the `.eslintrc.json` file, replacing `<environment>` with the desired environment-specific config.
15
+ To use a shared configuration without any customizations, export it from a `eslint.config.js` file at the project root:
16
+ ```js
17
+ export { nodeConfig as default } from 'eslint-config-brightspace';
18
+ ```
19
+
20
+ Shared configurations can also be included in a custom configuration:
21
+ ```js
22
+ import { nodeConfig } from 'eslint-config-brightspace';
23
+
24
+ export default [
25
+ ...nodeConfig,
26
+ // Custom configuration
27
+ ];
28
+ ```
29
+
30
+ ### Additional File Extensions
31
+
32
+ Include extensions beyond `.js` files using the `addExtenstion` helper function:
33
+ ```js
34
+ import { addExtensions, nodeConfig } from 'eslint-config-brightspace';
35
+ export default addExtensions(nodeConfig, ['.js','.html']);
36
+ ```
37
+
38
+ ### Different Configurations for Different Directories
39
+
40
+ To include different configurations for specific directories, use the `setDirectoryConfigs` helper function. This replaces the [configuration hierarchy](https://eslint.org/docs/v8.x/use/configure/configuration-files#cascading-and-hierarchy) from `eslint8`.
41
+
42
+ Include the global configuration and specify the directory configurations. These will apply to all files inside the directory and recursively to any of its subdirectories.
43
+ ```js
44
+ import { litConfig, nodeConfig, setDirectoryConfigs, testingConfig } from 'eslint-config-brightspace';
16
45
 
17
- ```json
18
- {
19
- "extends": "brightspace/<environment>"
20
- }
46
+ export default setDirectoryConfigs(
47
+ litConfig,
48
+ {
49
+ 'test': testingConfig,
50
+ 'test/cli': nodeConfig
51
+ }
52
+ );
21
53
  ```
54
+ Note that each set configuration will force all prior configurations to ignore it. For example, for the above configuration, `litConfig` will ignore any files in the `test` directory; and `testingConfig` will ignore any files in the `test/cli` directory.
22
55
 
23
56
  ### Environment Specific Configs
24
57
 
25
58
  | Environment | Description |
26
59
  |--|--|
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 |
60
+ | `browserConfig` | use with code that runs in a browser |
61
+ | `litConfig` | use with [Lit](https://lit.dev/) projects |
62
+ | `testingConfig` | use with [@brightspace-ui/testing](https://github.com/BrightspaceUI/testing) test code |
63
+ | `nodeConfig` | use with [Node.js](https://nodejs.org) projects |
64
+ | `reactConfig` | use with [React](https://react.dev/) projects |
32
65
 
33
66
  Example:
34
67
 
35
- ```json
36
- {
37
- "extends": "brightspace/lit-config"
38
- }
68
+ ```js
69
+ export { nodeConfig as default } from 'eslint-config-brightspace';
39
70
  ```
40
71
 
41
72
  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.
@@ -0,0 +1,45 @@
1
+ // nr = not as per eslint:recommended
2
+ import js from '@eslint/js';
3
+
4
+ export default [js.configs.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, {
28
+ 'vars': 'all',
29
+ 'args': 'after-used',
30
+ 'ignoreRestSiblings': true
31
+ }],
32
+ 'no-use-before-define': [2, 'nofunc'], // nr
33
+ 'no-var': 2, // nr
34
+ 'object-curly-spacing': [2, 'always'],
35
+ 'prefer-const': 2, // nr
36
+ 'quotes': [2, 'single', 'avoid-escape'], // nr
37
+ 'semi': 2, // nr
38
+ 'space-before-blocks': [2, 'always'], // nr
39
+ 'space-before-function-paren': [2, 'never'], //nr
40
+ 'space-in-parens': [2, 'never'],
41
+ 'space-infix-ops': 2, // nr
42
+ 'strict': [2, 'global'], // nr
43
+ 'valid-typeof': 2
44
+ }
45
+ }];
@@ -0,0 +1,43 @@
1
+ import parser from '@babel/eslint-parser';
2
+ import globals from 'globals';
3
+ import baseConfig from './base.js';
4
+ import html from 'eslint-plugin-html';
5
+ import importPlugin from 'eslint-plugin-import';
6
+ import sortClassMembersPlugin from 'eslint-plugin-sort-class-members';
7
+ import { getSortMemberRules } from '../utils.js';
8
+
9
+ export default [
10
+ ...baseConfig,
11
+ {
12
+ plugins: {
13
+ html,
14
+ 'import': importPlugin,
15
+ 'sort-class-members': sortClassMembersPlugin
16
+ },
17
+ languageOptions: {
18
+ parser,
19
+ parserOptions: {
20
+ 'requireConfigFile': false
21
+ },
22
+ globals: {
23
+ ...globals.browser,
24
+ 'D2L': false
25
+ },
26
+ },
27
+ rules: {
28
+ 'arrow-spacing': 2,
29
+ 'no-confusing-arrow': 2,
30
+ 'no-duplicate-imports': 2,
31
+ 'no-useless-constructor': 2,
32
+ 'prefer-arrow-callback': 2,
33
+ 'prefer-spread': 2,
34
+ 'prefer-template': 2,
35
+ 'sort-imports': [2, { 'ignoreCase': true }],
36
+ 'strict': [2, 'never'],
37
+ 'import/extensions': ['error', 'ignorePackages'],
38
+ 'import/no-absolute-path': 2,
39
+ 'no-console': ['error', { 'allow': ['warn', 'error'] }],
40
+ ...getSortMemberRules()
41
+ }
42
+ }
43
+ ];
package/configs/lit.js ADDED
@@ -0,0 +1,78 @@
1
+ import browserConfig from './browser.js';
2
+ import lit from 'eslint-plugin-lit';
3
+ import { getSortMemberRules } from '../utils.js';
4
+
5
+ const sortMemberRules = getSortMemberRules([
6
+ '[lit-static-properties]',
7
+ '[static-properties]',
8
+ '[static-methods]',
9
+ '[properties]',
10
+ 'constructor',
11
+ '[accessor-pairs]',
12
+ '[accessors]',
13
+ '[lit-methods]',
14
+ '[methods]',
15
+ '[private-accessor-pairs]',
16
+ '[private-accessors]',
17
+ '[private-properties]',
18
+ '[private-methods]'
19
+ ], {
20
+ 'lit-methods': [
21
+ { 'name': 'adoptedCallback', 'type': 'method' },
22
+ { 'name': 'attributeChangedCallback', 'type': 'method' },
23
+ { 'name': 'connectedCallback', 'type': 'method' },
24
+ { 'name': 'disconnectedCallback', 'type': 'method' },
25
+ { 'name': 'firstUpdated', 'type': 'method' },
26
+ { 'name': 'getUpdateComplete', 'type': 'method' },
27
+ { 'name': 'performUpdate', 'type': 'method' },
28
+ { 'name': 'render', 'type': 'method' },
29
+ { 'name': 'scheduleUpdate', 'type': 'method' },
30
+ { 'name': 'shouldUpdate', 'type': 'method' },
31
+ { 'name': 'update', 'type': 'method' },
32
+ { 'name': 'updated', 'type': 'method' },
33
+ { 'name': 'willUpdate', 'type': 'method' }
34
+ ],
35
+ 'lit-static-properties': [
36
+ { 'name': 'properties', 'static': true },
37
+ { 'name': 'styles', 'static': true }
38
+ ]
39
+ });
40
+
41
+ export default [
42
+ ...browserConfig,
43
+ {
44
+ plugins: { lit },
45
+ rules: {
46
+ 'lit/attribute-value-entities': 2,
47
+ 'lit/binding-positions': 2,
48
+ 'lit/lifecycle-super': 2,
49
+ 'lit/no-duplicate-template-bindings': 2,
50
+ 'lit/no-invalid-escape-sequences': 2,
51
+ 'lit/no-invalid-html': 2,
52
+ 'lit/no-legacy-imports': 2,
53
+ 'lit/no-legacy-template-syntax': 2,
54
+ 'lit/no-private-properties': [2, { 'private': '^(__|_)' }],
55
+ 'lit/no-property-change-update': 2,
56
+ 'lit/no-native-attributes': 1,
57
+ 'lit/no-template-arrow': 2,
58
+ 'lit/no-template-bind': 2,
59
+ 'lit/no-template-map': 0,
60
+ 'lit/no-this-assign-in-render': 2,
61
+ 'lit/no-useless-template-literals': 2,
62
+ 'lit/no-value-attribute': 2,
63
+ 'lit/prefer-nothing': 2,
64
+ ...sortMemberRules
65
+ }
66
+ },
67
+ {
68
+ 'files': ['./**/lang/*.js'],
69
+ 'rules': {
70
+ 'quotes': 0
71
+ }
72
+ }, {
73
+ 'files': ['./**/demo/*.html'],
74
+ 'rules': {
75
+ 'no-console': 0
76
+ }
77
+ }
78
+ ];
@@ -0,0 +1,20 @@
1
+ import globals from 'globals';
2
+ import baseConfig from './base.js';
3
+
4
+ export default [
5
+ ...baseConfig,
6
+ {
7
+ 'languageOptions': {
8
+ 'parserOptions': {
9
+ 'sourceType': 'module'
10
+ },
11
+ 'globals': {
12
+ ...globals.node,
13
+ ...globals.es2024
14
+ },
15
+ },
16
+ 'rules': {
17
+ 'no-console':0
18
+ }
19
+ }
20
+ ];
@@ -0,0 +1,25 @@
1
+ import globals from 'globals';
2
+ import baseConfig from './base.js';
3
+ import react from 'eslint-plugin-react';
4
+
5
+ export default [
6
+ ...baseConfig,
7
+ {
8
+ 'languageOptions': {
9
+ 'parserOptions': {
10
+ 'ecmaFeatures': {
11
+ 'jsx': true
12
+ },
13
+ 'sourceType': 'module'
14
+ },
15
+ 'globals': {
16
+ ...globals.browser,
17
+ ...globals.es2015,
18
+ ...globals.jest,
19
+ ...globals.node,
20
+ },
21
+ 'ecmaVersion': 6,
22
+ },
23
+ 'plugins': { react }
24
+ }
25
+ ];
@@ -0,0 +1,16 @@
1
+ import globals from 'globals';
2
+ import litConfig from './lit.js';
3
+
4
+ export default [
5
+ ...litConfig,
6
+ {
7
+ 'languageOptions': {
8
+ 'globals': {
9
+ ...globals.mocha,
10
+ }
11
+ },
12
+ 'rules': {
13
+ 'no-invalid-this': 0
14
+ }
15
+ }
16
+ ];
package/index.js CHANGED
@@ -1,45 +1,8 @@
1
- // nr = not as per eslint:recommended
1
+ export { default as baseConfig } from './configs/base.js';
2
+ export { default as browserConfig } from './configs/browser.js';
3
+ export { default as litConfig } from './configs/lit.js';
4
+ export { default as nodeConfig } from './configs/node.js';
5
+ export { default as reactConfig } from './configs/react.js';
6
+ export { default as testingConfig } from './configs/testing.js';
7
+ export { addExtensions, setDirectoryConfigs } from './utils.js';
2
8
 
3
- module.exports = {
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, {
28
- "vars": "all",
29
- "args": "after-used",
30
- "ignoreRestSiblings": true
31
- }],
32
- "no-use-before-define": [2, "nofunc"], // nr
33
- "no-var": 2, // nr
34
- "object-curly-spacing": [2, "always"],
35
- "prefer-const": 2, // nr
36
- "quotes": [2, "single", "avoid-escape"], // nr
37
- "semi": 2, // nr
38
- "space-before-blocks": [2, "always"], // nr
39
- "space-before-function-paren": [2, "never"], //nr
40
- "space-in-parens": [2, "never"],
41
- "space-infix-ops": 2, // nr
42
- "strict": [2, "global"], // nr
43
- "valid-typeof": 2
44
- }
45
- };
package/package.json CHANGED
@@ -1,10 +1,14 @@
1
1
  {
2
2
  "name": "eslint-config-brightspace",
3
- "version": "1.3.1",
3
+ "version": "2.0.0",
4
4
  "description": "Common Brightspace eslint configs.",
5
- "main": "index.js",
5
+ "exports": {
6
+ ".": "./index.js"
7
+ },
8
+ "type": "module",
6
9
  "scripts": {
7
- "test": "exit 0"
10
+ "test": "npm run lint:eslint",
11
+ "lint:eslint": "eslint ."
8
12
  },
9
13
  "repository": {
10
14
  "type": "git",
@@ -16,13 +20,9 @@
16
20
  "eslintconfig"
17
21
  ],
18
22
  "files": [
19
- "browser-config.js",
20
23
  "index.js",
21
- "lit-config.js",
22
- "node-config.js",
23
- "react-config.js",
24
- "sort-member-config.js",
25
- "testing-config.js"
24
+ "/configs",
25
+ "utils.js"
26
26
  ],
27
27
  "author": "D2L Corporation",
28
28
  "license": "Apache-2.0",
@@ -36,6 +36,8 @@
36
36
  "eslint-plugin-html": "^7 || ^8",
37
37
  "eslint-plugin-import": "^2",
38
38
  "eslint-plugin-lit": "^1",
39
- "eslint-plugin-sort-class-members": "^1"
39
+ "eslint-plugin-sort-class-members": "^1",
40
+ "eslint-plugin-react": "^7",
41
+ "globals": "^15"
40
42
  }
41
43
  }
package/utils.js ADDED
@@ -0,0 +1,79 @@
1
+ //@ts-check
2
+ const defaultGroups = {
3
+ 'accessor-pairs': [{ 'accessorPair': true, 'sort': 'alphabetical' }],
4
+ 'accessors': [{ 'kind': 'get', 'accessorPair': false, 'sort': 'alphabetical' }, { 'kind': 'set', 'accessorPair': false, 'sort': 'alphabetical' }],
5
+ 'methods': [{ 'type': 'method', 'sort': 'alphabetical' }],
6
+ 'private-accessor-pairs': [{ 'name': '/(_|#).+/', 'accessorPair': true, 'sort': 'alphabetical' }],
7
+ 'private-accessors': [{ 'name': '/(_|#).+/', 'kind': 'get', 'accessorPair': false, 'sort': 'alphabetical' }, { 'name': '/(_|#).+/', 'kind': 'set', 'accessorPair': false, 'sort': 'alphabetical' }],
8
+ 'private-methods': [{ 'name': '/(_|#).+/', 'type': 'method', 'sort': 'alphabetical' }],
9
+ 'private-properties': [{ 'name': '/(_|#).+/', 'type': 'property', 'sort': 'none' }],
10
+ 'properties': [{ 'type': 'property', 'sort': 'none' }],
11
+ 'static-methods': [{ 'type': 'method', 'sort': 'alphabetical', 'static': true }],
12
+ 'static-properties': [{ 'type': 'property', 'sort': 'none', 'static': true }]
13
+ };
14
+
15
+ const defaultOrder = [
16
+ '[static-properties]',
17
+ '[static-methods]',
18
+ '[properties]',
19
+ 'constructor',
20
+ '[accessor-pairs]',
21
+ '[accessors]',
22
+ '[methods]',
23
+ '[private-properties]',
24
+ '[private-accessor-pairs]',
25
+ '[private-accessors]',
26
+ '[private-methods]'
27
+ ];
28
+
29
+ export const getSortMemberRules = (order, groups) => {
30
+ return {
31
+ 'sort-class-members/sort-class-members': [2, {
32
+ 'order': order ? order : defaultOrder,
33
+ 'groups': { ...defaultGroups, ...groups },
34
+ 'accessorPairPositioning': 'getThenSet'
35
+ }]
36
+ };
37
+ };
38
+
39
+ export function setDirectoryConfigs(globalConfig, directoryConfigs) {
40
+ const configs = globalConfig.map(c => ({ ...c }));
41
+ for (const dir in directoryConfigs) {
42
+ const pattern = `${dir}/**/*`;
43
+ for (const baseConfig of configs) {
44
+ if (!(baseConfig.ignores)) baseConfig.ignores = [];
45
+ baseConfig.ignores.push(pattern);
46
+ }
47
+
48
+ for (const dirConfig of directoryConfigs[dir]) {
49
+ const files = dirConfig.files ? dirConfig.files.map(f => {
50
+ if (f.startsWith('./')) return `${dir}${f.slice(1)}`;
51
+ if (f.startsWith('*')) return `${dir}${f}`;
52
+ return `${dir}/${f}`;
53
+ }) : [pattern];
54
+ configs.push({
55
+ ...dirConfig,
56
+ files
57
+ });
58
+ }
59
+ }
60
+
61
+ return configs;
62
+ }
63
+
64
+ export function addExtensions(config, extensions) {
65
+ return config.map(c => {
66
+ const newFiles = [];
67
+ for (const f of (c.files ?? ['**/*'])) {
68
+ if (f.includes('.')) newFiles.push(f);
69
+ else {
70
+ for (const ext of extensions)
71
+ newFiles.push(`${f}${f.endsWith('*') ? '' : '*'}${ext}`);
72
+ }
73
+ }
74
+ return {
75
+ ...c,
76
+ files: newFiles
77
+ };
78
+ });
79
+ }
package/browser-config.js DELETED
@@ -1,36 +0,0 @@
1
- const { getSortMemberRules } = require('./sort-member-config');
2
-
3
- module.exports = {
4
- "extends": "./index.js",
5
- "parser": "@babel/eslint-parser",
6
- "parserOptions": {
7
- "requireConfigFile": false
8
- },
9
- "env": {
10
- "browser": true,
11
- "es2024": true
12
- },
13
- "plugins": [
14
- "html",
15
- "import",
16
- "sort-class-members"
17
- ],
18
- "globals": {
19
- "D2L": false
20
- },
21
- "rules": {
22
- "arrow-spacing": 2,
23
- "no-confusing-arrow": 2,
24
- "no-duplicate-imports": 2,
25
- "no-useless-constructor": 2,
26
- "prefer-arrow-callback": 2,
27
- "prefer-spread": 2,
28
- "prefer-template": 2,
29
- "sort-imports": [2, { "ignoreCase": true }],
30
- "strict": [2, "never"],
31
- "import/extensions": ["error", "ignorePackages"],
32
- "import/no-absolute-path": 2,
33
- "no-console": ["error", { "allow": ["warn", "error"] }],
34
- ...getSortMemberRules()
35
- }
36
- };
package/lit-config.js DELETED
@@ -1,78 +0,0 @@
1
- const { getSortMemberRules } = require('./sort-member-config');
2
-
3
- const sortMemberRules = getSortMemberRules([
4
- "[lit-static-properties]",
5
- "[static-properties]",
6
- "[static-methods]",
7
- "[properties]",
8
- "constructor",
9
- "[accessor-pairs]",
10
- "[accessors]",
11
- "[lit-methods]",
12
- "[methods]",
13
- "[private-accessor-pairs]",
14
- "[private-accessors]",
15
- "[private-properties]",
16
- "[private-methods]"
17
- ], {
18
- "lit-methods": [
19
- { "name": "adoptedCallback", "type": "method" },
20
- { "name": "attributeChangedCallback", "type": "method" },
21
- { "name": "connectedCallback", "type": "method" },
22
- { "name": "disconnectedCallback", "type": "method" },
23
- { "name": "firstUpdated", "type": "method" },
24
- { "name": "getUpdateComplete", "type": "method" },
25
- { "name": "performUpdate", "type": "method" },
26
- { "name": "render", "type": "method" },
27
- { "name": "scheduleUpdate", "type": "method" },
28
- { "name": "shouldUpdate", "type": "method" },
29
- { "name": "update", "type": "method" },
30
- { "name": "updated", "type": "method" },
31
- { "name": "willUpdate", "type": "method" }
32
- ],
33
- "lit-static-properties": [
34
- { "name": "properties", "static": true },
35
- { "name": "styles", "static": true }
36
- ]
37
- });
38
-
39
- module.exports = {
40
- "extends": "./browser-config.js",
41
- "plugins": [
42
- "import",
43
- "lit",
44
- "sort-class-members"
45
- ],
46
- "overrides": [{
47
- "files": "./**/lang/*.js",
48
- "rules": {
49
- "quotes": 0
50
- }
51
- },{
52
- "files": "./**/demo/*.html",
53
- "rules": {
54
- "no-console": 0
55
- }
56
- }],
57
- "rules": {
58
- "lit/attribute-value-entities": 2,
59
- "lit/binding-positions": 2,
60
- "lit/lifecycle-super": 2,
61
- "lit/no-duplicate-template-bindings": 2,
62
- "lit/no-invalid-escape-sequences": 2,
63
- "lit/no-invalid-html": 2,
64
- "lit/no-legacy-imports": 2,
65
- "lit/no-legacy-template-syntax": 2,
66
- "lit/no-private-properties": [2, { "private": "^(__|_)" }],
67
- "lit/no-property-change-update": 2,
68
- "lit/no-native-attributes": 1,
69
- "lit/no-template-arrow": 2,
70
- "lit/no-template-bind": 2,
71
- "lit/no-template-map": 0,
72
- "lit/no-this-assign-in-render": 2,
73
- "lit/no-useless-template-literals": 2,
74
- "lit/no-value-attribute": 2,
75
- "lit/prefer-nothing": 2,
76
- ...sortMemberRules
77
- }
78
- };
package/node-config.js DELETED
@@ -1,13 +0,0 @@
1
- module.exports = {
2
- "extends": "./index.js",
3
- "env": {
4
- "es2024": true,
5
- "node": true
6
- },
7
- "parserOptions": {
8
- "sourceType": "module"
9
- },
10
- "rules": {
11
- "no-console":0
12
- }
13
- };
package/react-config.js DELETED
@@ -1,18 +0,0 @@
1
- module.exports = {
2
- "extends": "./index.js",
3
- "parserOptions": {
4
- "ecmaFeatures": {
5
- "jsx": true
6
- },
7
- "sourceType": "module"
8
- },
9
- "env": {
10
- "browser": true,
11
- "es6": true,
12
- "jest": true,
13
- "node": true
14
- },
15
- "plugins": [
16
- "react"
17
- ]
18
- };
@@ -1,36 +0,0 @@
1
- const defaultGroups = {
2
- "accessor-pairs": [{ "accessorPair": true, "sort": "alphabetical" }],
3
- "accessors": [{ "kind": "get", "accessorPair": false, "sort": "alphabetical" }, { "kind": "set", "accessorPair": false, "sort": "alphabetical" }],
4
- "methods": [{ "type": "method", "sort": "alphabetical" }],
5
- "private-accessor-pairs": [{ "name": "/(_|#).+/", "accessorPair": true, "sort": "alphabetical" }],
6
- "private-accessors": [{ "name": "/(_|#).+/", "kind": "get", "accessorPair": false, "sort": "alphabetical" }, { "name": "/(_|#).+/", "kind": "set", "accessorPair": false, "sort": "alphabetical" }],
7
- "private-methods": [{ "name": "/(_|#).+/", "type": "method", "sort": "alphabetical" }],
8
- "private-properties": [{ "name": "/(_|#).+/", "type": "property", "sort": "none" }],
9
- "properties": [{ "type": "property", "sort": "none" }],
10
- "static-methods": [{ "type": "method", "sort": "alphabetical", "static": true }],
11
- "static-properties": [{ "type": "property", "sort": "none", "static": true }]
12
- };
13
-
14
- const defaultOrder = [
15
- "[static-properties]",
16
- "[static-methods]",
17
- "[properties]",
18
- "constructor",
19
- "[accessor-pairs]",
20
- "[accessors]",
21
- "[methods]",
22
- "[private-properties]",
23
- "[private-accessor-pairs]",
24
- "[private-accessors]",
25
- "[private-methods]"
26
- ];
27
-
28
- module.exports.getSortMemberRules = (order, groups) => {
29
- return {
30
- "sort-class-members/sort-class-members": [2, {
31
- "order": order ? order : defaultOrder,
32
- "groups": {...defaultGroups, ...groups},
33
- "accessorPairPositioning": "getThenSet"
34
- }]
35
- };
36
- };
package/testing-config.js DELETED
@@ -1,9 +0,0 @@
1
- module.exports = {
2
- "extends": "./lit-config.js",
3
- "env": {
4
- "mocha": true
5
- },
6
- "rules": {
7
- "no-invalid-this": 0
8
- }
9
- };