@jcoreio/toolchain 5.0.2 → 5.1.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.
@@ -13,6 +13,7 @@ module.exports = async function runHook(hookName) {
13
13
  let hooks
14
14
  try {
15
15
  hooks = require(Path.join(projDir, 'githooks.cjs'))
16
+ // eslint-disable-next-line no-unused-vars
16
17
  } catch (error) {
17
18
  hooks = require('../githooks.cjs')
18
19
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jcoreio/toolchain",
3
- "version": "5.0.2",
3
+ "version": "5.1.0",
4
4
  "description": "base JS build toolchain",
5
5
  "repository": {
6
6
  "type": "git",
@@ -17,8 +17,8 @@
17
17
  "@jcoreio/eslint-plugin-implicit-dependencies": "^1.1.1",
18
18
  "chalk": "^4.0.0",
19
19
  "dedent-js": "^1.0.1",
20
- "eslint": "^8.56.0",
21
- "eslint-config-prettier": "^8.8.0",
20
+ "eslint": "^9.17.0",
21
+ "eslint-config-prettier": "^9.1.0",
22
22
  "execa": "^5.0.0",
23
23
  "find-up": "^5.0.0",
24
24
  "fs-extra": "^10.0.0",
@@ -27,7 +27,7 @@
27
27
  "lint-staged": "^15.2.2",
28
28
  "minimatch": "^10.0.1",
29
29
  "open": "^8.4.0",
30
- "prettier": "^2.5.1",
30
+ "prettier": "^3.4.2",
31
31
  "prompts": "^2.4.2",
32
32
  "resolve-bin": "^1.0.0",
33
33
  "semver": "^7.5.3",
@@ -33,20 +33,20 @@ module.exports = [
33
33
  /* eslint-env node, es2018 */
34
34
  module.exports = {
35
35
  extends: [require.resolve('${name}/eslintConfig.cjs')],${
36
- env
37
- ? `\nenv: ${JSON.stringify(env, null, 2).replace(
38
- /\n/gm,
39
- '\n '
40
- )},`
41
- : ''
42
- }${
43
- rules
44
- ? `\nrules: ${JSON.stringify(rules, null, 2).replace(
45
- /\n/gm,
46
- '\n '
47
- )}`
48
- : ''
49
- }
36
+ env
37
+ ? `\nenv: ${JSON.stringify(env, null, 2).replace(
38
+ /\n/gm,
39
+ '\n '
40
+ )},`
41
+ : ''
42
+ }${
43
+ rules
44
+ ? `\nrules: ${JSON.stringify(rules, null, 2).replace(
45
+ /\n/gm,
46
+ '\n '
47
+ )}`
48
+ : ''
49
+ }
50
50
  }
51
51
  `,
52
52
  'toolchain.config.cjs': async (existing) => {
@@ -1,5 +1,8 @@
1
+ const getPluginsArraySync = require('./util/getPluginsArraySync.cjs')
2
+
1
3
  module.exports = {
2
4
  semi: false,
3
5
  singleQuote: true,
4
6
  trailingComma: 'es5',
7
+ overrides: getPluginsArraySync('prettierOverrides'),
5
8
  }
@@ -34,6 +34,7 @@ async function create(args = []) {
34
34
  encoding: 'utf8',
35
35
  })
36
36
  ).stdout.trim()
37
+ // eslint-disable-next-line no-unused-vars
37
38
  } catch (error) {
38
39
  // ignore
39
40
  }
@@ -20,9 +20,9 @@ async function installGitHooks() {
20
20
  } else {
21
21
  // chmod in case pnpm doesn't preserve mode of hooks scripts
22
22
  await Promise.all(
23
- (
24
- await fs.readdir(githooksDir)
25
- ).map((hook) => fs.chmod(Path.join(githooksDir, hook), 0o755))
23
+ (await fs.readdir(githooksDir)).map((hook) =>
24
+ fs.chmod(Path.join(githooksDir, hook), 0o755)
25
+ )
26
26
  )
27
27
  await execa('git', [
28
28
  'config',
@@ -175,6 +175,7 @@ async function migrateProjectPackageJson({ fromVersion }) {
175
175
  ) {
176
176
  pkgSection[dep] = versionRange
177
177
  }
178
+ // eslint-disable-next-line no-unused-vars
178
179
  } catch (error) {
179
180
  // ignore; package.json probably has a version like workspace:* etc
180
181
  }
@@ -5,10 +5,10 @@ const getPluginsArraySync = require('../util/getPluginsArraySync.cjs')
5
5
  async function eslintArgs() {
6
6
  return [
7
7
  ...((await fs.pathExists('.eslintignore'))
8
- ? ['--ignore-path', '.eslintignore']
8
+ ? ['--ignore-pattern', '.eslintignore']
9
9
  : (await fs.pathExists('.gitignore'))
10
- ? ['--ignore-path', '.gitignore']
11
- : []),
10
+ ? ['--ignore-pattern', '.gitignore']
11
+ : []),
12
12
  '--ignore-pattern',
13
13
  'flow-typed/',
14
14
  '--ext',
@@ -17,7 +17,12 @@ async function eslintArgs() {
17
17
  }
18
18
 
19
19
  async function runEslint(args = []) {
20
- await execa('eslint', [...args, ...(await eslintArgs())])
20
+ await execa('eslint', [...args, ...(await eslintArgs())], {
21
+ env: {
22
+ ...process.env,
23
+ ESLINT_USE_FLAT_CONFIG: 'false',
24
+ },
25
+ })
21
26
  }
22
27
  exports.runEslint = runEslint
23
28
 
@@ -5,8 +5,8 @@ async function prettierArgs() {
5
5
  return (await fs.pathExists('.prettierignore'))
6
6
  ? ['--ignore-path', '.prettierignore']
7
7
  : (await fs.pathExists('.gitignore'))
8
- ? ['--ignore-path', '.gitignore']
9
- : []
8
+ ? ['--ignore-path', '.gitignore']
9
+ : []
10
10
  }
11
11
 
12
12
  async function runPrettier(args = []) {
@@ -50,11 +50,11 @@ const scripts = toolchainConfig
50
50
  description: script,
51
51
  }
52
52
  : !script || typeof script === 'string'
53
- ? {
54
- run: () => {},
55
- description: '(no-op)',
56
- }
57
- : script,
53
+ ? {
54
+ run: () => {},
55
+ description: '(no-op)',
56
+ }
57
+ : script,
58
58
  ])
59
59
  ),
60
60
  }
@@ -92,7 +92,7 @@ async function toolchain(command, args) {
92
92
  }
93
93
 
94
94
  try {
95
- if (!command.startsWith('pre' && scripts[`pre${command}`])) {
95
+ if (!command.startsWith('pre') && scripts[`pre${command}`]) {
96
96
  await (scripts[`pre${command}`] && scripts[`pre${command}`].run(args))
97
97
  }
98
98
  await script.run(args)
package/util/execa.cjs CHANGED
@@ -17,6 +17,7 @@ function getExecaArgs(command, args, options, ...rest) {
17
17
  let projectDir, toolchainPackages
18
18
  try {
19
19
  ;({ projectDir, toolchainPackages } = require('./findUps.cjs'))
20
+ // eslint-disable-next-line no-unused-vars
20
21
  } catch (error) {
21
22
  projectDir = process.cwd()
22
23
  toolchainPackages = []
package/util/findUps.cjs CHANGED
@@ -100,19 +100,21 @@ for (const pkg of toolchainPackages) {
100
100
  toolchainPackageJsons[pkg] =
101
101
  pkg === packageJson.name
102
102
  ? packageJson
103
- : require(isToolchainDev
104
- ? Path.resolve(
105
- __dirname,
106
- '..',
107
- '..',
108
- pkg === '@jcoreio/toolchain'
109
- ? 'base'
110
- : pkg.replace('@jcoreio/toolchain-', ''),
111
- 'package.json'
112
- )
113
- : require.resolve(`${pkg}/package.json`, {
114
- paths: [projectDir],
115
- }))
103
+ : require(
104
+ isToolchainDev
105
+ ? Path.resolve(
106
+ __dirname,
107
+ '..',
108
+ '..',
109
+ pkg === '@jcoreio/toolchain'
110
+ ? 'base'
111
+ : pkg.replace('@jcoreio/toolchain-', ''),
112
+ 'package.json'
113
+ )
114
+ : require.resolve(`${pkg}/package.json`, {
115
+ paths: [projectDir],
116
+ })
117
+ )
116
118
  }
117
119
 
118
120
  let toolchainConfigFile
@@ -120,6 +122,7 @@ try {
120
122
  toolchainConfigFile = require.resolve(
121
123
  Path.join(exports.projectDir, 'toolchain.config.cjs')
122
124
  )
125
+ // eslint-disable-next-line no-unused-vars
123
126
  } catch (error) {
124
127
  // ignore
125
128
  }
@@ -22,10 +22,10 @@ module.exports = async function getModules(packageJsonFile) {
22
22
  ? /\.cjs$/.test(file)
23
23
  ? 'commonjs'
24
24
  : /\.mjs$/.test(file)
25
- ? 'module'
26
- : /\.js$/.test(file)
27
- ? defaultType
28
- : undefined
25
+ ? 'module'
26
+ : /\.js$/.test(file)
27
+ ? defaultType
28
+ : undefined
29
29
  : undefined
30
30
  ) {
31
31
  if (!file) return
@@ -55,8 +55,8 @@ module.exports = async function getModules(packageJsonFile) {
55
55
  (key === 'require'
56
56
  ? 'commonjs'
57
57
  : key === 'import'
58
- ? 'module'
59
- : undefined)
58
+ ? 'module'
59
+ : undefined)
60
60
  )
61
61
  }
62
62
  }
@@ -10,6 +10,7 @@ function getPlugins(name) {
10
10
  path = require.resolve(Path.join(pkg, 'plugins', `${name}.cjs`), {
11
11
  paths: [projectDir],
12
12
  })
13
+ // eslint-disable-next-line no-unused-vars
13
14
  } catch (error) {
14
15
  continue
15
16
  }