eslint-config-brightspace 2.1.0 → 2.1.2
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/package.json +3 -3
- package/utils.js +8 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-config-brightspace",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.2",
|
|
4
4
|
"description": "Common Brightspace eslint configs.",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./index.js"
|
|
@@ -30,10 +30,10 @@
|
|
|
30
30
|
"url": "https://github.com/Brightspace/eslint-config-brightspace/issues"
|
|
31
31
|
},
|
|
32
32
|
"homepage": "https://github.com/Brightspace/eslint-config-brightspace",
|
|
33
|
-
"
|
|
33
|
+
"dependencies": {
|
|
34
34
|
"@babel/eslint-parser": ">= 7",
|
|
35
35
|
"eslint": ">= 7",
|
|
36
|
-
"eslint-plugin-html": "^
|
|
36
|
+
"eslint-plugin-html": "^8",
|
|
37
37
|
"eslint-plugin-import": "^2",
|
|
38
38
|
"eslint-plugin-lit": "^1",
|
|
39
39
|
"eslint-plugin-sort-class-members": "^1",
|
package/utils.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//@ts-check
|
|
2
1
|
const defaultGroups = {
|
|
3
2
|
'accessor-pairs': [{ 'accessorPair': true, 'sort': 'alphabetical' }],
|
|
4
3
|
'accessors': [{ 'kind': 'get', 'accessorPair': false, 'sort': 'alphabetical' }, { 'kind': 'set', 'accessorPair': false, 'sort': 'alphabetical' }],
|
|
@@ -36,16 +35,23 @@ export const getSortMemberRules = (order, groups) => {
|
|
|
36
35
|
};
|
|
37
36
|
};
|
|
38
37
|
|
|
38
|
+
function isGlobalIgnores(config) {
|
|
39
|
+
const keys = Object.keys(config);
|
|
40
|
+
return keys.length === 1 && keys[0] === 'ignores';
|
|
41
|
+
}
|
|
42
|
+
|
|
39
43
|
export function setDirectoryConfigs(globalConfig, directoryConfigs) {
|
|
40
44
|
const configs = globalConfig.map(c => ({ ...c }));
|
|
41
45
|
for (const dir in directoryConfigs) {
|
|
42
46
|
const pattern = `${dir}/**/*`;
|
|
43
47
|
for (const baseConfig of configs) {
|
|
48
|
+
if (isGlobalIgnores(baseConfig)) continue;
|
|
44
49
|
if (!(baseConfig.ignores)) baseConfig.ignores = [];
|
|
45
50
|
baseConfig.ignores.push(pattern);
|
|
46
51
|
}
|
|
47
52
|
|
|
48
53
|
for (const dirConfig of directoryConfigs[dir]) {
|
|
54
|
+
if (isGlobalIgnores(dirConfig)) continue;
|
|
49
55
|
const files = dirConfig.files ? dirConfig.files.map(f => `${dir}/${f}`) : [pattern];
|
|
50
56
|
configs.push({
|
|
51
57
|
...dirConfig,
|
|
@@ -59,6 +65,7 @@ export function setDirectoryConfigs(globalConfig, directoryConfigs) {
|
|
|
59
65
|
|
|
60
66
|
export function addExtensions(config, extensions) {
|
|
61
67
|
return config.map(c => {
|
|
68
|
+
if (isGlobalIgnores(c)) return c;
|
|
62
69
|
const newFiles = [];
|
|
63
70
|
for (const f of (c.files ?? ['**/*'])) {
|
|
64
71
|
if (f.includes('.')) newFiles.push(f);
|