common-lint
Advanced tools
Comparing version 1.0.2 to 2.0.0
57
index.js
#!/usr/bin/env node | ||
const findPackageJson = require('find-package-json') | ||
const childProcess = require('child_process') | ||
const args = process.argv.slice(2) | ||
const startLocation = args.reduce((acc, cur) => { | ||
const startsWithDash = cur.startsWith('-') | ||
if (startsWithDash === false) { | ||
acc = cur | ||
} | ||
return acc | ||
}, process.cwd()) | ||
// It's important that we start looking in the process CWD. | ||
// We don't use `__dirname` here because it's the path to this file. | ||
const startLocation = process.cwd() | ||
const finder = findPackageJson(startLocation) | ||
@@ -12,13 +23,39 @@ | ||
const packageFile = finder.next() | ||
const { dependencies, devDependencies } = packageFile.value | ||
const hasPackageFile = packageFile.value != null | ||
const allDependencies = [dependencies, devDependencies] | ||
const hasStandard = allDependencies.some((deps = {}) => | ||
Object.keys(deps).includes('standard') | ||
) | ||
let command = 'eslint' | ||
if (hasStandard) { | ||
require('standard/bin/cmd') | ||
} else { | ||
require('eslint/bin/eslint') | ||
if (hasPackageFile) { | ||
const { dependencies, devDependencies } = packageFile.value | ||
const allDependencies = [dependencies, devDependencies] | ||
const hasStandard = allDependencies.some((deps = {}) => | ||
Object.keys(deps).includes('standard') | ||
) | ||
if (hasStandard) { | ||
command = 'standard' | ||
} | ||
} | ||
const notFoundError = ` | ||
Could not locate "${command}", is it installed? | ||
- npm -g install ${command} | ||
- yarn global add ${command} | ||
Please ensure that "${command} --help" works and then try again. | ||
` | ||
try { | ||
childProcess.execFileSync(command, args, { | ||
stdio: 'inherit' | ||
}) | ||
} catch (err) { | ||
// We can safely ignore most errors, but we *do* want to catch "not found" | ||
// errors and output them to the user. | ||
if (err.code === 'ENOENT') { | ||
console.error(notFoundError) | ||
process.exit(127) | ||
} | ||
} |
{ | ||
"name": "common-lint", | ||
"version": "1.0.2", | ||
"version": "2.0.0", | ||
"description": "compatibility for both standard and eslint", | ||
@@ -11,13 +11,19 @@ "main": "index.js", | ||
"dependencies": { | ||
"eslint": "^6.4.0", | ||
"find-package-json": "^1.2.0", | ||
"standard": "^14.3.1" | ||
"find-package-json": "^1.2.0" | ||
}, | ||
"peerDependencies": { | ||
"eslint": "*", | ||
"standard": "*" | ||
}, | ||
"bin": { | ||
"common-lint": "index.js", | ||
"clint": "index.js" | ||
"common-lint": "./index.js", | ||
"clint": "./index.js" | ||
}, | ||
"scripts": { | ||
"test": "index.js" | ||
"test": "./index.js" | ||
}, | ||
"devDependencies": { | ||
"eslint": "^6.4.0", | ||
"standard": "^14.3.1" | ||
} | ||
} |
@@ -5,4 +5,2 @@ # common-lint | ||
## Usage | ||
@@ -41,3 +39,3 @@ | ||
```shell | ||
npm -g install common-readme | ||
npm -g install common-lint | ||
``` | ||
@@ -48,3 +46,3 @@ | ||
```shell | ||
yarn global add common-readme | ||
yarn global add common-lint | ||
``` | ||
@@ -51,0 +49,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3273
46
2
51
1
+ Added@eslint-community/eslint-utils@4.4.1(transitive)
+ Added@eslint-community/regexpp@4.12.1(transitive)
+ Added@eslint/config-array@0.19.1(transitive)
+ Added@eslint/core@0.10.0(transitive)
+ Added@eslint/eslintrc@2.1.43.2.0(transitive)
+ Added@eslint/js@8.57.19.18.0(transitive)
+ Added@eslint/object-schema@2.1.5(transitive)
+ Added@eslint/plugin-kit@0.2.5(transitive)
+ Added@humanfs/core@0.19.1(transitive)
+ Added@humanfs/node@0.16.6(transitive)
+ Added@humanwhocodes/config-array@0.13.0(transitive)
+ Added@humanwhocodes/module-importer@1.0.1(transitive)
+ Added@humanwhocodes/object-schema@2.0.3(transitive)
+ Added@humanwhocodes/retry@0.3.10.4.1(transitive)
+ Added@nodelib/fs.scandir@2.1.5(transitive)
+ Added@nodelib/fs.stat@2.0.5(transitive)
+ Added@nodelib/fs.walk@1.2.8(transitive)
+ Added@rtsao/scc@1.1.0(transitive)
+ Added@types/estree@1.0.6(transitive)
+ Added@types/json-schema@7.0.15(transitive)
+ Added@types/json5@0.0.29(transitive)
+ Added@ungap/structured-clone@1.2.1(transitive)
+ Addedacorn@8.14.0(transitive)
+ Addedargparse@2.0.1(transitive)
+ Addedarray.prototype.findlast@1.2.5(transitive)
+ Addedarray.prototype.findlastindex@1.2.5(transitive)
+ Addedarray.prototype.flat@1.3.3(transitive)
+ Addedarray.prototype.flatmap@1.3.3(transitive)
+ Addedarray.prototype.tosorted@1.1.4(transitive)
+ Addedbuiltins@5.1.0(transitive)
+ Addedcross-spawn@7.0.6(transitive)
+ Addedes-iterator-helpers@1.2.1(transitive)
+ Addedes-shim-unscopables@1.0.2(transitive)
+ Addedescape-string-regexp@4.0.0(transitive)
+ Addedeslint@8.57.19.18.0(transitive)
+ Addedeslint-config-standard@17.1.0(transitive)
+ Addedeslint-config-standard-jsx@11.0.0(transitive)
+ Addedeslint-plugin-es@4.1.0(transitive)
+ Addedeslint-plugin-import@2.31.0(transitive)
+ Addedeslint-plugin-n@15.7.0(transitive)
+ Addedeslint-plugin-promise@6.6.0(transitive)
+ Addedeslint-plugin-react@7.37.4(transitive)
+ Addedeslint-scope@7.2.28.2.0(transitive)
+ Addedeslint-utils@2.1.03.0.0(transitive)
+ Addedeslint-visitor-keys@2.1.03.4.34.2.0(transitive)
+ Addedespree@10.3.09.6.1(transitive)
+ Addedfastq@1.18.0(transitive)
+ Addedfile-entry-cache@6.0.18.0.0(transitive)
+ Addedfind-up@5.0.0(transitive)
+ Addedflat-cache@3.2.04.0.1(transitive)
+ Addedflatted@3.3.2(transitive)
+ Addedget-stdin@8.0.0(transitive)
+ Addedglob-parent@6.0.2(transitive)
+ Addedglobals@13.24.014.0.0(transitive)
+ Addedgraphemer@1.4.0(transitive)
+ Addedis-path-inside@3.0.3(transitive)
+ Addediterator.prototype@1.1.5(transitive)
+ Addedjs-yaml@4.1.0(transitive)
+ Addedjson-buffer@3.0.1(transitive)
+ Addedjson5@1.0.2(transitive)
+ Addedjsx-ast-utils@3.3.5(transitive)
+ Addedkeyv@4.5.4(transitive)
+ Addedlevn@0.4.1(transitive)
+ Addedlocate-path@6.0.0(transitive)
+ Addedlodash.merge@4.6.2(transitive)
+ Addedobject.groupby@1.0.3(transitive)
+ Addedoptionator@0.9.4(transitive)
+ Addedp-limit@3.1.0(transitive)
+ Addedp-locate@5.0.0(transitive)
+ Addedpath-exists@4.0.0(transitive)
+ Addedpath-key@3.1.1(transitive)
+ Addedprelude-ls@1.2.1(transitive)
+ Addedresolve@2.0.0-next.5(transitive)
+ Addedreusify@1.0.4(transitive)
+ Addedrimraf@3.0.2(transitive)
+ Addedsemver@7.6.3(transitive)
+ Addedshebang-command@2.0.0(transitive)
+ Addedshebang-regex@3.0.0(transitive)
+ Addedstandard@17.1.2(transitive)
+ Addedstandard-engine@15.1.0(transitive)
+ Addedstring.prototype.matchall@4.0.12(transitive)
+ Addedstring.prototype.repeat@1.0.0(transitive)
+ Addedtsconfig-paths@3.15.0(transitive)
+ Addedtype-check@0.4.0(transitive)
+ Addedtype-fest@0.20.2(transitive)
+ Addedversion-guard@1.1.3(transitive)
+ Addedwhich@2.0.2(transitive)
+ Addedxdg-basedir@4.0.0(transitive)
+ Addedyocto-queue@0.1.0(transitive)
- Removedeslint@^6.4.0
- Removedstandard@^14.3.1
- Removed@babel/code-frame@7.26.2(transitive)
- Removed@babel/helper-validator-identifier@7.25.9(transitive)
- Removedacorn@7.4.1(transitive)
- Removedansi-escapes@4.3.2(transitive)
- Removedansi-regex@4.1.1(transitive)
- Removedansi-styles@3.2.1(transitive)
- Removedargparse@1.0.10(transitive)
- Removedastral-regex@1.0.0(transitive)
- Removedchalk@2.4.2(transitive)
- Removedchardet@0.7.0(transitive)
- Removedcli-cursor@3.1.0(transitive)
- Removedcli-width@3.0.0(transitive)
- Removedcolor-convert@1.9.3(transitive)
- Removedcolor-name@1.1.3(transitive)
- Removedcontains-path@0.1.0(transitive)
- Removedcross-spawn@6.0.6(transitive)
- Removeddebug@2.6.9(transitive)
- Removeddebug-log@1.0.1(transitive)
- Removeddeglob@4.0.1(transitive)
- Removeddoctrine@1.5.0(transitive)
- Removedemoji-regex@7.0.38.0.0(transitive)
- Removedescape-string-regexp@1.0.5(transitive)
- Removedeslint@6.8.0(transitive)
- Removedeslint-config-standard@14.1.1(transitive)
- Removedeslint-config-standard-jsx@8.1.0(transitive)
- Removedeslint-plugin-es@2.0.0(transitive)
- Removedeslint-plugin-import@2.18.2(transitive)
- Removedeslint-plugin-node@10.0.0(transitive)
- Removedeslint-plugin-promise@4.2.1(transitive)
- Removedeslint-plugin-react@7.14.3(transitive)
- Removedeslint-plugin-standard@4.0.2(transitive)
- Removedeslint-scope@5.1.1(transitive)
- Removedeslint-utils@1.4.3(transitive)
- Removedespree@6.2.1(transitive)
- Removedesprima@4.0.1(transitive)
- Removedestraverse@4.3.0(transitive)
- Removedexternal-editor@3.1.0(transitive)
- Removedfigures@3.2.0(transitive)
- Removedfile-entry-cache@5.0.1(transitive)
- Removedfind-root@1.1.0(transitive)
- Removedfind-up@2.1.0(transitive)
- Removedflat-cache@2.0.1(transitive)
- Removedflatted@2.0.2(transitive)
- Removedfunctional-red-black-tree@1.0.1(transitive)
- Removedget-stdin@7.0.0(transitive)
- Removedglob-parent@5.1.2(transitive)
- Removedglobals@12.4.0(transitive)
- Removedhas@1.0.4(transitive)
- Removedhas-flag@3.0.0(transitive)
- Removedhosted-git-info@2.8.9(transitive)
- Removediconv-lite@0.4.24(transitive)
- Removedignore@4.0.6(transitive)
- Removedinquirer@7.3.3(transitive)
- Removedis-fullwidth-code-point@2.0.03.0.0(transitive)
- Removedisarray@1.0.0(transitive)
- Removedjs-yaml@3.14.1(transitive)
- Removedjsx-ast-utils@2.4.1(transitive)
- Removedlevn@0.3.0(transitive)
- Removedload-json-file@2.0.0(transitive)
- Removedlocate-path@2.0.0(transitive)
- Removedlodash@4.17.21(transitive)
- Removedmimic-fn@2.1.0(transitive)
- Removedmkdirp@0.5.6(transitive)
- Removedms@2.0.0(transitive)
- Removedmute-stream@0.0.8(transitive)
- Removednice-try@1.0.5(transitive)
- Removednormalize-package-data@2.5.0(transitive)
- Removedonetime@5.1.2(transitive)
- Removedoptionator@0.8.3(transitive)
- Removedos-tmpdir@1.0.2(transitive)
- Removedp-limit@1.3.0(transitive)
- Removedp-locate@2.0.0(transitive)
- Removedp-try@1.0.0(transitive)
- Removedparse-json@2.2.0(transitive)
- Removedpath-key@2.0.1(transitive)
- Removedpath-type@2.0.0(transitive)
- Removedpicocolors@1.1.1(transitive)
- Removedpify@2.3.0(transitive)
- Removedpkg-config@1.1.1(transitive)
- Removedprelude-ls@1.1.2(transitive)
- Removedprogress@2.0.3(transitive)
- Removedread-pkg@2.0.0(transitive)
- Removedread-pkg-up@2.0.0(transitive)
- Removedregexpp@2.0.1(transitive)
- Removedrestore-cursor@3.1.0(transitive)
- Removedrimraf@2.6.3(transitive)
- Removedrun-async@2.4.1(transitive)
- Removedrxjs@6.6.7(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedsemver@5.7.2(transitive)
- Removedshebang-command@1.2.0(transitive)
- Removedshebang-regex@1.0.0(transitive)
- Removedsignal-exit@3.0.7(transitive)
- Removedslice-ansi@2.1.0(transitive)
- Removedspdx-correct@3.2.0(transitive)
- Removedspdx-exceptions@2.5.0(transitive)
- Removedspdx-expression-parse@3.0.1(transitive)
- Removedspdx-license-ids@3.0.20(transitive)
- Removedsprintf-js@1.0.3(transitive)
- Removedstandard@14.3.4(transitive)
- Removedstandard-engine@12.1.0(transitive)
- Removedstring-width@3.1.04.2.3(transitive)
- Removedstrip-ansi@5.2.0(transitive)
- Removedsupports-color@5.5.0(transitive)
- Removedtable@5.4.6(transitive)
- Removedthrough@2.3.8(transitive)
- Removedtmp@0.0.33(transitive)
- Removedtslib@1.14.1(transitive)
- Removedtype-check@0.3.2(transitive)
- Removedtype-fest@0.21.30.8.1(transitive)
- Removeduniq@1.0.1(transitive)
- Removedv8-compile-cache@2.4.0(transitive)
- Removedvalidate-npm-package-license@3.0.4(transitive)
- Removedwhich@1.3.1(transitive)
- Removedwrite@1.0.3(transitive)
- Removedxtend@4.0.2(transitive)