@jcoreio/toolchain 5.2.0 → 5.3.1
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/eslintConfig.cjs +1 -6
- package/lint-staged.config.cjs +6 -6
- package/package.json +11 -5
- package/plugins/getConfigFiles.cjs +56 -66
- package/plugins/getEslintConfigs.cjs +105 -0
- package/prettier.config.cjs +1 -0
- package/scripts/create.cjs +28 -27
- package/scripts/init.cjs +3 -5
- package/scripts/migrate/migrateEslintConfigs.cjs +2 -16
- package/scripts/migrate/migrateProjectPackageJson.cjs +37 -35
- package/scripts/migrate/migrateRemoveDevDeps.cjs +7 -0
- package/scripts/migrate.cjs +2 -3
- package/scripts/runEslint.cjs +1 -27
- package/scripts/runPrettier.cjs +6 -5
- package/scripts/toolchain.cjs +15 -14
- package/scripts/upgrade.cjs +16 -16
- package/util/ParseState.cjs +6 -4
- package/util/confirm.cjs +2 -2
- package/util/findUps.cjs +47 -45
- package/util/getModules.cjs +8 -13
- package/util/migrateLegacyEslintConfigs.cjs +218 -0
- package/util/sortPlugins.cjs +5 -1
- package/.eslintrc.js +0 -6
- package/bin/eslint +0 -5
- package/bin/lint-fix.cjs +0 -8
- package/bin/lint-staged +0 -5
- package/bin/prettier +0 -5
- package/bin/resolveBin.cjs +0 -8
- package/bin/semantic-release +0 -5
- package/eslint.extends.cjs +0 -79
- package/plugins/getEslintExtends.cjs +0 -1
package/scripts/toolchain.cjs
CHANGED
|
@@ -13,8 +13,9 @@ try {
|
|
|
13
13
|
throw error
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
const scripts =
|
|
17
|
-
?
|
|
16
|
+
const scripts =
|
|
17
|
+
toolchainConfig ?
|
|
18
|
+
{
|
|
18
19
|
badges: require('./badges.cjs'),
|
|
19
20
|
migrate: require('./migrate.cjs'),
|
|
20
21
|
build: require('./build.cjs'),
|
|
@@ -43,18 +44,18 @@ const scripts = toolchainConfig
|
|
|
43
44
|
...Object.fromEntries(
|
|
44
45
|
Object.entries(toolchainConfig.scripts || {}).map(([name, script]) => [
|
|
45
46
|
name,
|
|
46
|
-
typeof script === 'string' && script.trim()
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
47
|
+
typeof script === 'string' && script.trim() ?
|
|
48
|
+
{
|
|
49
|
+
run: (args = []) =>
|
|
50
|
+
execa([script, ...args].join(' '), { shell: true }),
|
|
51
|
+
description: script,
|
|
52
|
+
}
|
|
53
|
+
: !script || typeof script === 'string' ?
|
|
54
|
+
{
|
|
55
|
+
run: () => {},
|
|
56
|
+
description: '(no-op)',
|
|
57
|
+
}
|
|
58
|
+
: script,
|
|
58
59
|
])
|
|
59
60
|
),
|
|
60
61
|
}
|
package/scripts/upgrade.cjs
CHANGED
|
@@ -49,22 +49,22 @@ async function upgrade([version] = []) {
|
|
|
49
49
|
|
|
50
50
|
await execa(
|
|
51
51
|
'pnpm',
|
|
52
|
-
isTest
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
52
|
+
isTest ?
|
|
53
|
+
[
|
|
54
|
+
...(isMonorepoRoot ? ['-r'] : []),
|
|
55
|
+
'add',
|
|
56
|
+
'-D',
|
|
57
|
+
'--prefer-offline',
|
|
58
|
+
'../packages/base',
|
|
59
|
+
...toolchains.map((t) => t.replace(`${name}-`, '../packages/')),
|
|
60
|
+
]
|
|
61
|
+
: [
|
|
62
|
+
...(isMonorepoRoot ? ['-r'] : []),
|
|
63
|
+
'update',
|
|
64
|
+
'--prefer-offline',
|
|
65
|
+
`${name}@^${version}`,
|
|
66
|
+
...toolchains.map((t) => `${t}@^${version}`),
|
|
67
|
+
]
|
|
68
68
|
)
|
|
69
69
|
if (isMonorepoRoot) await execa('pnpm', ['run', '-r', 'tc', 'migrate'])
|
|
70
70
|
else await execa('tc', ['migrate'])
|
package/util/ParseState.cjs
CHANGED
|
@@ -42,10 +42,12 @@ class ParseState {
|
|
|
42
42
|
)
|
|
43
43
|
pattern.lastIndex = this.index
|
|
44
44
|
const match = pattern.exec(this.input)
|
|
45
|
-
return
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
return (
|
|
46
|
+
match &&
|
|
47
|
+
match.index === this.index &&
|
|
48
|
+
match.index + match[0].length <= this.end
|
|
49
|
+
) ?
|
|
50
|
+
match
|
|
49
51
|
: undefined
|
|
50
52
|
}
|
|
51
53
|
|
package/util/confirm.cjs
CHANGED
package/util/findUps.cjs
CHANGED
|
@@ -8,10 +8,9 @@ const { name } = require('../package.json')
|
|
|
8
8
|
const configSchema = require('./configSchema.cjs')
|
|
9
9
|
|
|
10
10
|
const cwd = (
|
|
11
|
-
fs.pathExistsSync(Path.join(process.cwd(), 'package.json'))
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
).replace(/\/node_modules(\/.*|$)/, '')
|
|
11
|
+
fs.pathExistsSync(Path.join(process.cwd(), 'package.json')) ?
|
|
12
|
+
process.cwd()
|
|
13
|
+
: __filename).replace(/\/node_modules(\/.*|$)/, '')
|
|
15
14
|
|
|
16
15
|
const packageJsonFile = (exports.packageJsonFile = findUp.sync('package.json', {
|
|
17
16
|
cwd,
|
|
@@ -32,37 +31,38 @@ const pnpmWorkspaceFile = (exports.pnpmWorkspaceFile = findUp.sync(
|
|
|
32
31
|
type: 'file',
|
|
33
32
|
}
|
|
34
33
|
))
|
|
35
|
-
const pnpmWorkspace =
|
|
36
|
-
|
|
34
|
+
const pnpmWorkspace =
|
|
35
|
+
pnpmWorkspaceFile ?
|
|
36
|
+
require('yaml').parse(fs.readFileSync(pnpmWorkspaceFile, 'utf8'))
|
|
37
37
|
: undefined
|
|
38
38
|
|
|
39
39
|
const isMonorepoSubpackage = (exports.isMonorepoSubpackage =
|
|
40
|
-
pnpmWorkspace && Array.isArray(pnpmWorkspace.packages)
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
)
|
|
40
|
+
pnpmWorkspace && Array.isArray(pnpmWorkspace.packages) ?
|
|
41
|
+
pnpmWorkspace.packages.some((p) =>
|
|
42
|
+
new RegExp(`^${p.replace(/\*/g, '[^/]+')}$`).test(
|
|
43
|
+
Path.relative(Path.dirname(pnpmWorkspaceFile), projectDir)
|
|
45
44
|
)
|
|
46
|
-
|
|
45
|
+
)
|
|
46
|
+
: false)
|
|
47
47
|
|
|
48
48
|
const isMonorepoRoot = (exports.isMonorepoRoot =
|
|
49
49
|
pnpmWorkspaceFile != null && Path.dirname(pnpmWorkspaceFile) === projectDir)
|
|
50
50
|
|
|
51
51
|
const monorepoProjectDir = (exports.monorepoProjectDir =
|
|
52
|
-
isMonorepoSubpackage || isMonorepoRoot
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
isMonorepoSubpackage || isMonorepoRoot ?
|
|
53
|
+
Path.dirname(pnpmWorkspaceFile)
|
|
54
|
+
: undefined)
|
|
55
55
|
|
|
56
56
|
const monorepoPackageJsonFile = (exports.monorepoPackageJsonFile =
|
|
57
|
-
monorepoProjectDir
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
exports.monorepoPackageJson =
|
|
61
|
-
? fs.readJsonSync(monorepoPackageJsonFile)
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
57
|
+
monorepoProjectDir ?
|
|
58
|
+
Path.join(monorepoProjectDir, 'package.json')
|
|
59
|
+
: undefined)
|
|
60
|
+
exports.monorepoPackageJson =
|
|
61
|
+
monorepoPackageJsonFile ? fs.readJsonSync(monorepoPackageJsonFile) : undefined
|
|
62
|
+
|
|
63
|
+
exports.monorepoSubpackageJsonFiles =
|
|
64
|
+
pnpmWorkspace ?
|
|
65
|
+
[
|
|
66
66
|
...new Set(
|
|
67
67
|
pnpmWorkspace.packages.flatMap((p) =>
|
|
68
68
|
globSync(Path.join(p, 'package.json'), { cwd: monorepoProjectDir })
|
|
@@ -71,8 +71,9 @@ exports.monorepoSubpackageJsonFiles = pnpmWorkspace
|
|
|
71
71
|
].map((f) => Path.resolve(monorepoProjectDir, f))
|
|
72
72
|
: undefined
|
|
73
73
|
|
|
74
|
-
exports.monorepoSubpackageJsons =
|
|
75
|
-
|
|
74
|
+
exports.monorepoSubpackageJsons =
|
|
75
|
+
exports.monorepoSubpackageJsonFiles ?
|
|
76
|
+
exports.monorepoSubpackageJsonFiles.map((f) => fs.readJsonSync(f))
|
|
76
77
|
: undefined
|
|
77
78
|
|
|
78
79
|
const findGitDir = once(function findGitDir(cwd = process.cwd()) {
|
|
@@ -98,23 +99,23 @@ const isToolchainDev = Path.normalize(__dirname)
|
|
|
98
99
|
const toolchainPackageJsons = (exports.toolchainPackageJsons = {})
|
|
99
100
|
for (const pkg of toolchainPackages) {
|
|
100
101
|
toolchainPackageJsons[pkg] =
|
|
101
|
-
pkg === packageJson.name
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
102
|
+
pkg === packageJson.name ?
|
|
103
|
+
packageJson
|
|
104
|
+
: require(
|
|
105
|
+
isToolchainDev ?
|
|
106
|
+
Path.resolve(
|
|
107
|
+
__dirname,
|
|
108
|
+
'..',
|
|
109
|
+
'..',
|
|
110
|
+
pkg === '@jcoreio/toolchain' ? 'base' : (
|
|
111
|
+
pkg.replace('@jcoreio/toolchain-', '')
|
|
112
|
+
),
|
|
113
|
+
'package.json'
|
|
114
|
+
)
|
|
115
|
+
: require.resolve(`${pkg}/package.json`, {
|
|
116
|
+
paths: [projectDir],
|
|
117
|
+
})
|
|
118
|
+
)
|
|
118
119
|
}
|
|
119
120
|
|
|
120
121
|
let toolchainConfigFile
|
|
@@ -136,8 +137,9 @@ try {
|
|
|
136
137
|
toolchainConfigFile ? require(toolchainConfigFile) : packageJson[name] || {}
|
|
137
138
|
)
|
|
138
139
|
} catch (error) {
|
|
139
|
-
const toolchainConfigLocation =
|
|
140
|
-
?
|
|
140
|
+
const toolchainConfigLocation =
|
|
141
|
+
toolchainConfigFile ?
|
|
142
|
+
Path.relative(cwd, toolchainConfigFile)
|
|
141
143
|
: `packageJson[${JSON.stringify(name)}]`
|
|
142
144
|
|
|
143
145
|
// eslint-disable-next-line no-console
|
package/util/getModules.cjs
CHANGED
|
@@ -18,15 +18,12 @@ module.exports = async function getModules(packageJsonFile) {
|
|
|
18
18
|
const defaultType = type
|
|
19
19
|
function checkFile(
|
|
20
20
|
file,
|
|
21
|
-
type = file
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
? 'module'
|
|
26
|
-
: /\.js$/.test(file)
|
|
27
|
-
? defaultType
|
|
28
|
-
: undefined
|
|
21
|
+
type = file ?
|
|
22
|
+
/\.cjs$/.test(file) ? 'commonjs'
|
|
23
|
+
: /\.mjs$/.test(file) ? 'module'
|
|
24
|
+
: /\.js$/.test(file) ? defaultType
|
|
29
25
|
: undefined
|
|
26
|
+
: undefined
|
|
30
27
|
) {
|
|
31
28
|
if (!file) return
|
|
32
29
|
if (type === 'commonjs') cjs.add(file)
|
|
@@ -52,11 +49,9 @@ module.exports = async function getModules(packageJsonFile) {
|
|
|
52
49
|
await checkExport(
|
|
53
50
|
value,
|
|
54
51
|
type ||
|
|
55
|
-
(key === 'require'
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
? 'module'
|
|
59
|
-
: undefined)
|
|
52
|
+
(key === 'require' ? 'commonjs'
|
|
53
|
+
: key === 'import' ? 'module'
|
|
54
|
+
: undefined)
|
|
60
55
|
)
|
|
61
56
|
}
|
|
62
57
|
}
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
const { name } = require('../package.json')
|
|
2
|
+
const { format } = require('prettier')
|
|
3
|
+
const prettierConfig = require('../prettier.config.cjs')
|
|
4
|
+
const { statement, expression, default: template } = require('@babel/template')
|
|
5
|
+
const { generate } = require('@babel/generator')
|
|
6
|
+
const path = require('path')
|
|
7
|
+
const t = require('@babel/types')
|
|
8
|
+
|
|
9
|
+
const objectExpression = (props) =>
|
|
10
|
+
t.objectExpression(
|
|
11
|
+
Object.entries(props).flatMap(([key, value]) =>
|
|
12
|
+
value ? [t.objectProperty(t.identifier(key), value)] : []
|
|
13
|
+
)
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
const idOrString = (value) =>
|
|
17
|
+
/^[_a-z$][_a-z0-9$]*$/.test(value) ?
|
|
18
|
+
t.identifier(value)
|
|
19
|
+
: t.stringLiteral(value)
|
|
20
|
+
|
|
21
|
+
const member = (object, key) => {
|
|
22
|
+
const prop = idOrString(key)
|
|
23
|
+
return t.memberExpression(object, prop, prop.type !== 'Identifier')
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function isSimpleObjectExpression(obj) {
|
|
27
|
+
return (
|
|
28
|
+
obj &&
|
|
29
|
+
obj.type === 'ObjectExpression' &&
|
|
30
|
+
obj.properties.every(
|
|
31
|
+
(p) =>
|
|
32
|
+
p.type === 'ObjectProperty' &&
|
|
33
|
+
!p.computed &&
|
|
34
|
+
(p.key.type === 'Identifier' || p.key.type === 'StringLiteral')
|
|
35
|
+
)
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function decodeSimpleObjectExpression(obj) {
|
|
40
|
+
if (!isSimpleObjectExpression(obj)) {
|
|
41
|
+
throw new Error(
|
|
42
|
+
'obj is not an ObjectExpression containing only non-computed identifier- or string-keyed properties'
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
return Object.fromEntries(
|
|
46
|
+
obj.properties.map((p) => [
|
|
47
|
+
p.key.type === 'Identifier' ? p.key.name : p.key.value,
|
|
48
|
+
p.value,
|
|
49
|
+
])
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async function migrateLegacyEslintConfigs(configs) {
|
|
54
|
+
const body = [
|
|
55
|
+
statement.ast`const { defineConfig } = require('eslint/config')`,
|
|
56
|
+
]
|
|
57
|
+
const warnings = {}
|
|
58
|
+
let importedGlobals = false
|
|
59
|
+
|
|
60
|
+
function importGlobals() {
|
|
61
|
+
if (importedGlobals) return
|
|
62
|
+
body.push(statement.ast`const globals = require('globals')`)
|
|
63
|
+
importedGlobals = true
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const CONFIG = expression.ast(`[...require('${name}/eslintConfig.cjs')]`)
|
|
67
|
+
for (const [file, content] of Object.entries(configs)) {
|
|
68
|
+
function warn(warning) {
|
|
69
|
+
;(warnings[file] || (warnings[file] = [])).push(warning)
|
|
70
|
+
}
|
|
71
|
+
if (/\.[cm]?js$/.test(file)) {
|
|
72
|
+
const { parse } = require('@babel/parser')
|
|
73
|
+
let parsed
|
|
74
|
+
try {
|
|
75
|
+
parsed = parse(content, { sourceType: 'unambiguous' })
|
|
76
|
+
} catch (error) {
|
|
77
|
+
warn(`parse error: ${error.message}`)
|
|
78
|
+
continue
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const exportStatement = parsed.program.body.find(
|
|
82
|
+
(s) =>
|
|
83
|
+
s.type === 'ExpressionStatement' &&
|
|
84
|
+
s.expression.type === 'AssignmentExpression' &&
|
|
85
|
+
generate(s.expression.left).code === 'module.exports' &&
|
|
86
|
+
s.expression.right.type === 'ObjectExpression'
|
|
87
|
+
)
|
|
88
|
+
if (!exportStatement) {
|
|
89
|
+
warn('module.exports = statement not found')
|
|
90
|
+
continue
|
|
91
|
+
}
|
|
92
|
+
const config = exportStatement.expression.right
|
|
93
|
+
|
|
94
|
+
if (!isSimpleObjectExpression(config)) {
|
|
95
|
+
warn(
|
|
96
|
+
'config is not an ObjectExpression or has spread or computed properties'
|
|
97
|
+
)
|
|
98
|
+
continue
|
|
99
|
+
}
|
|
100
|
+
const {
|
|
101
|
+
extends: _extends,
|
|
102
|
+
env: _env,
|
|
103
|
+
rules,
|
|
104
|
+
...rest
|
|
105
|
+
} = decodeSimpleObjectExpression(config)
|
|
106
|
+
|
|
107
|
+
for (const key of Object.keys(rest)) {
|
|
108
|
+
warn(
|
|
109
|
+
`migrating ${generate(member(t.identifier('config'), key)).code} is not currently supported`
|
|
110
|
+
)
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (_extends) {
|
|
114
|
+
const ext = generate(_extends).code
|
|
115
|
+
if (
|
|
116
|
+
ext !== `[require.resolve('@jcoreio/toolchain/eslintConfig.cjs')]` &&
|
|
117
|
+
ext !== `[require.resolve('@jcoreio/toolchain/eslint.config.cjs')]`
|
|
118
|
+
) {
|
|
119
|
+
warn(
|
|
120
|
+
`config.extends has entries other than base @jcoreio/toolchain eslint config`
|
|
121
|
+
)
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
let env
|
|
125
|
+
if (_env) {
|
|
126
|
+
if (isSimpleObjectExpression(_env)) {
|
|
127
|
+
env = decodeSimpleObjectExpression(_env)
|
|
128
|
+
for (const key in env) {
|
|
129
|
+
if (env[key].type !== 'BooleanLiteral') {
|
|
130
|
+
warn(
|
|
131
|
+
`config.${generate(member(t.identifier('env'), key)).code} is not a boolean`
|
|
132
|
+
)
|
|
133
|
+
delete env[key]
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
if (!Object.keys(env).length) env = undefined
|
|
137
|
+
} else {
|
|
138
|
+
warn(
|
|
139
|
+
`config.env is not an ObjectExpression or has spread or computed properties`
|
|
140
|
+
)
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if (!env && !rules) continue
|
|
145
|
+
|
|
146
|
+
if (env) importGlobals()
|
|
147
|
+
|
|
148
|
+
CONFIG.elements.push(
|
|
149
|
+
objectExpression({
|
|
150
|
+
files:
|
|
151
|
+
path.dirname(file) !== '.' &&
|
|
152
|
+
t.arrayExpression([t.stringLiteral(path.dirname(file) + '/**')]),
|
|
153
|
+
languageOptions:
|
|
154
|
+
env &&
|
|
155
|
+
objectExpression({
|
|
156
|
+
globals: t.objectExpression(
|
|
157
|
+
Object.keys(env).map((key) =>
|
|
158
|
+
t.spreadElement(member(t.identifier('globals'), key))
|
|
159
|
+
)
|
|
160
|
+
),
|
|
161
|
+
}),
|
|
162
|
+
rules,
|
|
163
|
+
})
|
|
164
|
+
)
|
|
165
|
+
} else {
|
|
166
|
+
const JSON5 = require('json5')
|
|
167
|
+
|
|
168
|
+
const props = JSON5.parse(content)
|
|
169
|
+
const { env, rules, ...rest } = props
|
|
170
|
+
|
|
171
|
+
for (const key of Object.keys(rest)) {
|
|
172
|
+
warn(
|
|
173
|
+
`migrating ${generate(member(t.identifier('config'), key)).code} is not currently supported`
|
|
174
|
+
)
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
if (!env && !rules) continue
|
|
178
|
+
|
|
179
|
+
if (env) importGlobals()
|
|
180
|
+
|
|
181
|
+
CONFIG.elements.push(
|
|
182
|
+
objectExpression({
|
|
183
|
+
files:
|
|
184
|
+
path.dirname(file) !== '.' &&
|
|
185
|
+
t.arrayExpression([t.stringLiteral(path.dirname(file) + '/**')]),
|
|
186
|
+
rules: rules && expression.ast(JSON.stringify(rules)),
|
|
187
|
+
languageOptions:
|
|
188
|
+
env &&
|
|
189
|
+
objectExpression({
|
|
190
|
+
globals: t.objectExpression(
|
|
191
|
+
Object.keys(env).map((key) =>
|
|
192
|
+
t.spreadElement(member(t.identifier('globals'), key))
|
|
193
|
+
)
|
|
194
|
+
),
|
|
195
|
+
}),
|
|
196
|
+
})
|
|
197
|
+
)
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
body.push(template`module.exports = defineConfig(CONFIG)`({ CONFIG }))
|
|
202
|
+
|
|
203
|
+
return {
|
|
204
|
+
migrated: await format(
|
|
205
|
+
generate(t.program(body)).code.replace(
|
|
206
|
+
/^module\.exports/m,
|
|
207
|
+
'\nmodule.exports'
|
|
208
|
+
),
|
|
209
|
+
{
|
|
210
|
+
...prettierConfig,
|
|
211
|
+
parser: 'babel',
|
|
212
|
+
}
|
|
213
|
+
),
|
|
214
|
+
warnings,
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
module.exports = migrateLegacyEslintConfigs
|
package/util/sortPlugins.cjs
CHANGED
package/.eslintrc.js
DELETED
package/bin/eslint
DELETED
package/bin/lint-fix.cjs
DELETED
package/bin/lint-staged
DELETED
package/bin/prettier
DELETED
package/bin/resolveBin.cjs
DELETED
package/bin/semantic-release
DELETED
package/eslint.extends.cjs
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
extends: ['eslint:recommended'],
|
|
3
|
-
plugins: ['@jcoreio/eslint-plugin-implicit-dependencies'],
|
|
4
|
-
rules: {
|
|
5
|
-
'@jcoreio/implicit-dependencies/no-implicit': [
|
|
6
|
-
'error',
|
|
7
|
-
{
|
|
8
|
-
dev: true,
|
|
9
|
-
peer: true,
|
|
10
|
-
optional: true,
|
|
11
|
-
},
|
|
12
|
-
],
|
|
13
|
-
'arrow-spacing': 'error',
|
|
14
|
-
'comma-spacing': 'error',
|
|
15
|
-
'computed-property-spacing': ['error', 'never'],
|
|
16
|
-
'eol-last': 'error',
|
|
17
|
-
'jsx-quotes': 'error',
|
|
18
|
-
'keyword-spacing': 'error',
|
|
19
|
-
'key-spacing': [
|
|
20
|
-
'error',
|
|
21
|
-
{
|
|
22
|
-
mode: 'strict',
|
|
23
|
-
},
|
|
24
|
-
],
|
|
25
|
-
'linebreak-style': 'error',
|
|
26
|
-
'no-console': 'error',
|
|
27
|
-
'no-unused-vars': [
|
|
28
|
-
'error',
|
|
29
|
-
{
|
|
30
|
-
args: 'none',
|
|
31
|
-
varsIgnorePattern: 'React',
|
|
32
|
-
},
|
|
33
|
-
],
|
|
34
|
-
'no-extra-semi': 'error',
|
|
35
|
-
'no-multi-spaces': 'error',
|
|
36
|
-
'no-multiple-empty-lines': 'error',
|
|
37
|
-
'no-trailing-spaces': 'error',
|
|
38
|
-
'no-unexpected-multiline': 'error',
|
|
39
|
-
'no-unreachable': 'error',
|
|
40
|
-
'no-whitespace-before-property': 'error',
|
|
41
|
-
'object-shorthand': ['error', 'always'],
|
|
42
|
-
'padded-blocks': ['error', 'never'],
|
|
43
|
-
semi: ['error', 'never'],
|
|
44
|
-
'space-before-blocks': ['error', 'always'],
|
|
45
|
-
'space-before-function-paren': [
|
|
46
|
-
'error',
|
|
47
|
-
{
|
|
48
|
-
anonymous: 'always',
|
|
49
|
-
named: 'never',
|
|
50
|
-
},
|
|
51
|
-
],
|
|
52
|
-
'space-in-parens': ['error', 'never'],
|
|
53
|
-
'space-infix-ops': ['error', { int32Hint: false }],
|
|
54
|
-
'space-unary-ops': [
|
|
55
|
-
'error',
|
|
56
|
-
{
|
|
57
|
-
words: true,
|
|
58
|
-
nonwords: false,
|
|
59
|
-
},
|
|
60
|
-
],
|
|
61
|
-
'rest-spread-spacing': ['error', 'never'],
|
|
62
|
-
},
|
|
63
|
-
overrides: [
|
|
64
|
-
{
|
|
65
|
-
files: ['src/**'],
|
|
66
|
-
excludedFiles: ['**/__tests__/**'],
|
|
67
|
-
rules: {
|
|
68
|
-
'@jcoreio/implicit-dependencies/no-implicit': [
|
|
69
|
-
'error',
|
|
70
|
-
{
|
|
71
|
-
dev: false,
|
|
72
|
-
peer: true,
|
|
73
|
-
optional: true,
|
|
74
|
-
},
|
|
75
|
-
],
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
],
|
|
79
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = [() => [require.resolve('../eslint.extends.cjs')]]
|