-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: improve file name matching (#395)
Allows the user to pass directory, filenames, and globs to the "check" and "apply" commands: yarn d2-style check *.js yarn d2-style check . yarn d2-style check src yarn d2-style check src/**/*.spec.js Note that the first example "*.js" means that basename matching is enabled so that if a file has a '/' in the path, it will still be a successful match. This allows us to simplify the patterns in d2style.config.js by saying that: patterns.js = '*.js' Instead of: patterns.js = '**/*.js' On the question why we aren't just passing along the argument as-is to eslint and prettier (they support "dir|file|glob" in their clis) the answer is two-fold: 1. We want to control which files are passed to the tool to avoid e.g. Prettier checking non-js files that it supports when we run "check js" for example. 2. We want to be able to only run checks against staged files, which means we have to filter out unstaged files from the list of files we pass to each tool.
- Loading branch information
Showing
6 changed files
with
25 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters