-
-
Notifications
You must be signed in to change notification settings - Fork 13
/
index.js
40 lines (30 loc) · 1.02 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
const adjunct = require('eslint-config-adjunct/configs')
const checkMissing = require('./lib/missing')
const showLoaded = require('./lib/loaded')
const { hasAnyDep } = require('./lib/utils')
const overridesRules = require('./rules/overrides')
const configs = require('./detect/configs')
const parsers = require('./detect/parsers')
const plugins = require('./detect/plugins')
const hasReact = hasAnyDep('react')
// Workaround VS Code trying to run this file twice!
if (!global.hasAutoConfigLoaded) {
const airbnbDependentcies = ['import']
if (hasReact) airbnbDependentcies.push('jsx-a11y', 'react', 'react-hooks')
checkMissing(
[...airbnbDependentcies, ...adjunct.rules, ...plugins],
adjunct.extraInstallPackage,
configs,
parsers
)
showLoaded(airbnbDependentcies)
global.hasAutoConfigLoaded = true
}
const autoConfig = {
extends: [...parsers, ...plugins, ...configs].map((config) =>
require.resolve(`./rules/${config}`)
),
...overridesRules,
}
// console.log(autoConfig)
module.exports = autoConfig