es-check 5.2.3 → 5.2.4

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.
Files changed (2) hide show
  1. package/index.js +42 -15
  2. package/package.json +17 -12
package/index.js CHANGED
@@ -24,11 +24,17 @@ prog
24
24
  .version(pkg.version)
25
25
  .argument(
26
26
  '[ecmaVersion]',
27
- 'ecmaVersion to check files against. Can be: es3, es4, es5, es6/es2015, es7/es2016, es8/es2017, es9/es2018, es10/es2019',
27
+ 'ecmaVersion to check files against. Can be: es3, es4, es5, es6/es2015, es7/es2016, es8/es2017, es9/es2018, es10/es2019'
28
+ )
29
+ .argument(
30
+ '[files...]',
31
+ 'a glob of files to to test the EcmaScript version against'
28
32
  )
29
- .argument('[files...]', 'a glob of files to to test the EcmaScript version against')
30
33
  .option('--module', 'use ES modules')
31
- .option('--allow-hash-bang', 'if the code starts with #! treat it as a comment')
34
+ .option(
35
+ '--allow-hash-bang',
36
+ 'if the code starts with #! treat it as a comment'
37
+ )
32
38
  .option('--not', 'folder or file names to skip', prog.LIST)
33
39
  .action((args, options, logger) => {
34
40
  const configFilePath = path.resolve(process.cwd(), '.escheckrc')
@@ -39,22 +45,32 @@ prog
39
45
  * - If one exists, default to those options
40
46
  * - If no command line arguments are passed in
41
47
  */
42
- const config = fs.existsSync(configFilePath) ? JSON.parse(fs.readFileSync(configFilePath)) : {}
43
- const expectedEcmaVersion = args.ecmaVersion ? args.ecmaVersion : config.ecmaVersion
48
+ const config = fs.existsSync(configFilePath)
49
+ ? JSON.parse(fs.readFileSync(configFilePath))
50
+ : {}
51
+ const expectedEcmaVersion = args.ecmaVersion
52
+ ? args.ecmaVersion
53
+ : config.ecmaVersion
44
54
  const files = args.files.length ? args.files : [].concat(config.files)
45
55
  const esmodule = options.module ? options.module : config.module
46
- const allowHashBang = options.allowHashBang ? options.allowHashBang : config.allowHashBang
47
- const pathsToIgnore = options.not.length ? options.not : [].concat(config.not || [])
56
+ const allowHashBang = options.allowHashBang
57
+ ? options.allowHashBang
58
+ : config.allowHashBang
59
+ const pathsToIgnore = options.not.length
60
+ ? options.not
61
+ : [].concat(config.not || [])
48
62
 
49
63
  if (!expectedEcmaVersion) {
50
64
  logger.error(
51
- 'No ecmaScript version passed in or found in .escheckrc. Please set your ecmaScript version in the CLI or in .escheckrc',
65
+ 'No ecmaScript version passed in or found in .escheckrc. Please set your ecmaScript version in the CLI or in .escheckrc'
52
66
  )
53
67
  process.exit(1)
54
68
  }
55
69
 
56
70
  if (!files || !files.length) {
57
- logger.error('No files were passed in please pass in a list of files to es-check!')
71
+ logger.error(
72
+ 'No files were passed in please pass in a list of files to es-check!'
73
+ )
58
74
  process.exit(1)
59
75
  }
60
76
 
@@ -115,7 +131,9 @@ prog
115
131
  ecmaVersion = '2021'
116
132
  break
117
133
  default:
118
- logger.error('Invalid ecmaScript version, please pass a valid version, use --help for help')
134
+ logger.error(
135
+ 'Invalid ecmaScript version, please pass a valid version, use --help for help'
136
+ )
119
137
  process.exit(1)
120
138
  }
121
139
 
@@ -134,7 +152,10 @@ prog
134
152
  const filterForIgnore = (globbedFiles) => {
135
153
  if (expandedPathsToIgnore && expandedPathsToIgnore.length > 0) {
136
154
  const filtered = globbedFiles.filter(
137
- (filePath) => !expandedPathsToIgnore.some((ignoreValue) => filePath.includes(ignoreValue)),
155
+ (filePath) =>
156
+ !expandedPathsToIgnore.some((ignoreValue) =>
157
+ filePath.includes(ignoreValue)
158
+ )
138
159
  )
139
160
  return filtered
140
161
  }
@@ -157,7 +178,9 @@ prog
157
178
  const globbedFiles = glob.sync(pattern, globOpts)
158
179
 
159
180
  if (globbedFiles.length === 0) {
160
- logger.error(`ES-Check: Did not find any files to check for ${pattern}.`)
181
+ logger.error(
182
+ `ES-Check: Did not find any files to check for ${pattern}.`
183
+ )
161
184
  process.exit(1)
162
185
  }
163
186
 
@@ -170,11 +193,13 @@ prog
170
193
  try {
171
194
  acorn.parse(code, acornOpts)
172
195
  } catch (err) {
173
- logger.debug(`ES-Check: failed to parse file: ${file} \n - error: ${err}`)
196
+ logger.debug(
197
+ `ES-Check: failed to parse file: ${file} \n - error: ${err}`
198
+ )
174
199
  const errorObj = {
175
200
  err,
176
201
  stack: err.stack,
177
- file,
202
+ file
178
203
  }
179
204
  errArray.push(errorObj)
180
205
  }
@@ -182,7 +207,9 @@ prog
182
207
  })
183
208
 
184
209
  if (errArray.length > 0) {
185
- logger.error(`ES-Check: there were ${errArray.length} ES version matching errors.`)
210
+ logger.error(
211
+ `ES-Check: there were ${errArray.length} ES version matching errors.`
212
+ )
186
213
  errArray.forEach((o) => {
187
214
  logger.info(`
188
215
  ES-Check Error:
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "es-check",
3
- "version": "5.2.3",
3
+ "version": "5.2.4",
4
4
  "description": "Checks the ECMAScript version of .js glob against a specified version of ECMAScript with a shell command",
5
5
  "main": "index.js",
6
+ "license": "MIT",
6
7
  "files": [
7
8
  "index.js"
8
9
  ],
@@ -27,26 +28,31 @@
27
28
  "url": "git+https://github.com/yowainwright/es-check.git"
28
29
  },
29
30
  "author": "Jeff Wainwright <yowainwright@gmail.com> (https://jeffry.in), Brian Gonzalez <me@briangonzalez.org>",
30
- "license": "MIT",
31
31
  "bugs": {
32
32
  "url": "https://github.com/yowainwright/es-check/issues"
33
33
  },
34
34
  "homepage": "https://github.com/yowainwright/es-check#readme",
35
35
  "devDependencies": {
36
- "@commitlint/cli": "^11.0.0",
37
- "@commitlint/config-conventional": "^11.0.0",
38
- "@commitlint/prompt": "^11.0.0",
39
- "@heartly/eslint-config": "^0.0.2",
40
- "@heartly/prettier-config": "^0.0.1",
36
+ "@commitlint/cli": "^12.0.1",
37
+ "@commitlint/config-conventional": "^12.0.1",
38
+ "@commitlint/prompt": "^12.0.1",
41
39
  "assert": "^2.0.0",
42
40
  "codecov": "^3.0.0",
43
41
  "commitizen": "^4.2.2",
44
42
  "conventional-changelog-cli": "^2.0.11",
45
- "eslint": "^6.6.0",
46
- "husky": "^4.3.7",
47
- "mocha": "^8.2.1",
43
+ "eslint": "^7.29.0",
44
+ "eslint-config-prettier": "^8.3.0",
45
+ "eslint-config-prettier-standard": "^4.0.1",
46
+ "eslint-config-standard": "^16.0.3",
47
+ "eslint-plugin-import": "^2.23.4",
48
+ "eslint-plugin-node": "^11.1.0",
49
+ "eslint-plugin-prettier": "^3.4.0",
50
+ "eslint-plugin-promise": "^5.1.0",
51
+ "husky": "^5.1.3",
52
+ "mocha": "^9.0.1",
48
53
  "nyc": "^15.1.0",
49
- "prettier": "^2.2.1"
54
+ "prettier": "^2.3.2",
55
+ "prettier-config-standard": "^4.0.0"
50
56
  },
51
57
  "dependencies": {
52
58
  "acorn": "^6.4.1",
@@ -74,7 +80,6 @@
74
80
  "test js version",
75
81
  "test ecmascript version"
76
82
  ],
77
- "prettier": "@heartly/eslint-config/dist/prettier",
78
83
  "commitlint": {
79
84
  "extends": [
80
85
  "@commitlint/config-conventional"