@sequencemedia/eslint-config-standard 0.1.6 → 0.1.7
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/config/index.mjs +3 -0
- package/config/recommended.mjs +17 -0
- package/merge.mjs +14 -1
- package/package.json +3 -1
- package/test/config/index.spec.mjs +17 -0
- package/test/config/recommended.spec.mjs +9 -0
- package/test/config/standard.spec.mjs +9 -0
- package/test/config/stylistic.spec.mjs +9 -0
- package/test/merge.spec.mjs +2 -8
- package/common/merge.mjs +0 -82
package/config/index.mjs
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import standard from './standard.mjs'
|
|
2
|
+
import stylistic from './stylistic.mjs'
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
name: '@sequencemedia/eslint-config-standard/recommended',
|
|
6
|
+
languageOptions: {
|
|
7
|
+
ecmaVersion: 'latest'
|
|
8
|
+
},
|
|
9
|
+
plugins: {
|
|
10
|
+
...standard.plugins,
|
|
11
|
+
...stylistic.plugins
|
|
12
|
+
},
|
|
13
|
+
rules: {
|
|
14
|
+
...standard.rules,
|
|
15
|
+
...stylistic.rules
|
|
16
|
+
}
|
|
17
|
+
}
|
package/merge.mjs
CHANGED
|
@@ -2,9 +2,22 @@ import getMapMerge from '@sequencemedia/eslint-merge/get-map-merge'
|
|
|
2
2
|
|
|
3
3
|
import eslintConfig from './index.mjs'
|
|
4
4
|
|
|
5
|
+
function include ({ name }) {
|
|
6
|
+
return name === '@sequencemedia/eslint-config-standard'
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function exclude ({ name }) {
|
|
10
|
+
return name !== '@sequencemedia/eslint-config-standard'
|
|
11
|
+
}
|
|
12
|
+
|
|
5
13
|
export default function mergeESLintConfigWith (config) {
|
|
6
14
|
return (
|
|
7
15
|
eslintConfig
|
|
8
|
-
.
|
|
16
|
+
.filter(include)
|
|
17
|
+
.concat(
|
|
18
|
+
eslintConfig
|
|
19
|
+
.filter(exclude)
|
|
20
|
+
.map(getMapMerge(config))
|
|
21
|
+
)
|
|
9
22
|
)
|
|
10
23
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sequencemedia/eslint-config-standard",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "Standard configuration for ESLint 9",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"JavaScript Standard Style",
|
|
@@ -70,6 +70,7 @@
|
|
|
70
70
|
"imports": {
|
|
71
71
|
"#eslint-config-standard": "./index.mjs",
|
|
72
72
|
"#eslint-config-standard/common": "./common/index.mjs",
|
|
73
|
+
"#eslint-config-standard/config": "./config/index.mjs",
|
|
73
74
|
"#eslint-config-standard/config/*": "./config/*.mjs",
|
|
74
75
|
"#eslint-config-standard/merge": "./merge.mjs",
|
|
75
76
|
"#eslint-config-standard/merge/*": "./merge/*.mjs"
|
|
@@ -77,6 +78,7 @@
|
|
|
77
78
|
"exports": {
|
|
78
79
|
".": "./index.mjs",
|
|
79
80
|
"./common": "./common/index.mjs",
|
|
81
|
+
"./config": "./config/index.mjs",
|
|
80
82
|
"./config/*": "./config/*.mjs",
|
|
81
83
|
"./merge": "./merge.mjs",
|
|
82
84
|
"./merge/*": "./merge/*.mjs"
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
expect
|
|
3
|
+
} from 'chai'
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
recommended,
|
|
7
|
+
standard,
|
|
8
|
+
stylistic
|
|
9
|
+
} from '@sequencemedia/eslint-config-standard/config'
|
|
10
|
+
|
|
11
|
+
describe('@sequencemedia/eslint-config-standard/config', () => {
|
|
12
|
+
describe('`recommended`', () => it('is an object', () => expect(recommended).to.be.an('object')))
|
|
13
|
+
|
|
14
|
+
describe('`standard`', () => it('is an object', () => expect(standard).to.be.an('object')))
|
|
15
|
+
|
|
16
|
+
describe('`stylistic`', () => it('is an object', () => expect(stylistic).to.be.an('object')))
|
|
17
|
+
})
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import {
|
|
2
|
+
expect
|
|
3
|
+
} from 'chai'
|
|
4
|
+
|
|
5
|
+
import recommended from '@sequencemedia/eslint-config-standard/config/recommended'
|
|
6
|
+
|
|
7
|
+
describe('@sequencemedia/eslint-config-standard/config/recommended', () => {
|
|
8
|
+
describe('`recommended`', () => it('is an object', () => expect(recommended).to.be.an('object')))
|
|
9
|
+
})
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import {
|
|
2
|
+
expect
|
|
3
|
+
} from 'chai'
|
|
4
|
+
|
|
5
|
+
import standard from '@sequencemedia/eslint-config-standard/config/standard'
|
|
6
|
+
|
|
7
|
+
describe('@sequencemedia/eslint-config-standard/config/standard', () => {
|
|
8
|
+
describe('`standard`', () => it('is an object', () => expect(standard).to.be.an('object')))
|
|
9
|
+
})
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import {
|
|
2
|
+
expect
|
|
3
|
+
} from 'chai'
|
|
4
|
+
|
|
5
|
+
import stylistic from '@sequencemedia/eslint-config-standard/config/stylistic'
|
|
6
|
+
|
|
7
|
+
describe('@sequencemedia/eslint-config-standard/config/stylistic', () => {
|
|
8
|
+
describe('`stylistic`', () => it('is an object', () => expect(stylistic).to.be.an('object')))
|
|
9
|
+
})
|
package/test/merge.spec.mjs
CHANGED
|
@@ -48,15 +48,9 @@ describe('@sequencemedia/eslint-config-standard/merge', () => {
|
|
|
48
48
|
.to.eql([
|
|
49
49
|
{
|
|
50
50
|
name: '@sequencemedia/eslint-config-standard',
|
|
51
|
-
files: MOCK_FILES,
|
|
52
|
-
ignores: MOCK_IGNORES,
|
|
53
51
|
languageOptions: {
|
|
54
|
-
ecmaVersion: 'latest'
|
|
55
|
-
|
|
56
|
-
},
|
|
57
|
-
linterOptions: MOCK_LINTER_OPTIONS,
|
|
58
|
-
rules: MOCK_RULES,
|
|
59
|
-
settings: MOCK_SETTINGS
|
|
52
|
+
ecmaVersion: 'latest'
|
|
53
|
+
}
|
|
60
54
|
},
|
|
61
55
|
{
|
|
62
56
|
...STANDARD,
|
package/common/merge.mjs
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
function hasLanguageOptionsParser ({ languageOptions: { parser = null } = {} }) {
|
|
2
|
-
return Boolean(parser)
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
function getLanguageOptionsParser ({ languageOptions: { parser = null } = {} }) {
|
|
6
|
-
return parser
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
function removeParserByEntriesKey ([key]) {
|
|
10
|
-
return key !== 'parser'
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export function getLanguageOptionsWithoutParser ({ languageOptions = {} }) {
|
|
14
|
-
const entries = Object.entries(languageOptions)
|
|
15
|
-
|
|
16
|
-
return (
|
|
17
|
-
Object.fromEntries(
|
|
18
|
-
entries.filter(removeParserByEntriesKey)
|
|
19
|
-
)
|
|
20
|
-
)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export function getLanguageOptions ({ languageOptions = {} }) {
|
|
24
|
-
return languageOptions
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export function getLinterOptions ({ linterOptions = {} }) {
|
|
28
|
-
return linterOptions
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export function getProcessor ({ processor = {} }) {
|
|
32
|
-
return processor
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export function getRules ({ rules = {} }) {
|
|
36
|
-
return rules
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export function getSettings ({ settings = {} }) {
|
|
40
|
-
return settings
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export function mergeLanguageOptions (alpha = {}, omega = {}) {
|
|
44
|
-
return (
|
|
45
|
-
Object
|
|
46
|
-
.assign(
|
|
47
|
-
hasLanguageOptionsParser(alpha) ? { parser: getLanguageOptionsParser(alpha) } : {},
|
|
48
|
-
structuredClone(getLanguageOptionsWithoutParser(alpha)),
|
|
49
|
-
getLanguageOptions(omega)
|
|
50
|
-
)
|
|
51
|
-
)
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export function mergeLinterOptions (alpha = {}, omega = {}) {
|
|
55
|
-
return (
|
|
56
|
-
Object
|
|
57
|
-
.assign(
|
|
58
|
-
structuredClone(getLinterOptions(alpha)),
|
|
59
|
-
getLinterOptions(omega)
|
|
60
|
-
)
|
|
61
|
-
)
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export function mergeRules (alpha = {}, omega = {}) {
|
|
65
|
-
return (
|
|
66
|
-
Object
|
|
67
|
-
.assign(
|
|
68
|
-
structuredClone(getRules(alpha)),
|
|
69
|
-
getRules(omega)
|
|
70
|
-
)
|
|
71
|
-
)
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export function mergeSettings (alpha = {}, omega = {}) {
|
|
75
|
-
return (
|
|
76
|
-
Object
|
|
77
|
-
.assign(
|
|
78
|
-
structuredClone(getSettings(alpha)),
|
|
79
|
-
getSettings(omega)
|
|
80
|
-
)
|
|
81
|
-
)
|
|
82
|
-
}
|