es-check icon indicating copy to clipboard operation
es-check copied to clipboard

Flag option for specifying files

Open merrywhether opened this issue 10 months ago • 1 comments

Requested Update

Add a way to describe files via a flag (something like -f/--files).

Why Is This Update Needed?

The would make it easier to work with a configuration file in the case where you want to vary which files you check without changing the ES version. Having files only come via positional arguments forces users to redeclare the ES version unnecessarily (getting error: Invalid ecmaScript version, please pass a valid version, use --help for help if they try to omit it and go straight to file paths).

Example

Say you have a configuration file like this:

{
  "ecmaVersion": "es6",
  "module": false,
  "files": "./dist/**/*.js",
  "not": ["./dist/skip/*.js"]
}

If you want to change which files are checked, you currently have to do this, duplicating the ES version declaration and introducing the possibility for drift:

es-check es6 './dist/app/**/*.js'

With a flag, you could do this:

es-check -f './dist/app/**/*.js'

This would be a small QoL improvement. The existing functionality would still be the primary way to declare files and would take precedence over a flag declaration in the event of duplication.

I'm happy to contribute this if the idea is accepted.

Are There Examples Of This Requested Update Elsewhere?

Read about references issues here. Provide paragraph text responses to each header.

merrywhether avatar Apr 11 '24 01:04 merrywhether

This is thoughtful @merrywhether ! Will look to add this or feel free to submit a PR.

yowainwright avatar Apr 24 '24 22:04 yowainwright