You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Integrate lint-staged to run linters against staged Git files to prevent to add code that violates any style guide into the code base.
Configuration
The configuration file lint-staged.config.js will be placed in the project root and includes the command that should be run for matching file extensions (globs). It will include at least the three following entries with the same order as listed here:
prettier --list-different - Run Prettier (Prettier #32) against *.{js,json,md,mdx,ts,tsx,yml} to ensure all files are formatted correctly. The --list-different prints the found files that are not conform to the Prettier configuration.
eslint - Run ESLint (ESLint #30) against *.{js,ts,tsx} to ensure all TypeScript and JavaScript files are compliant to the style guide after being formatted with Prettier.
remark --no-stdout - Run remark-lint (remark-lint #27) against *.md to ensure all Markdown files are compliant to the style guide. The --no-stdout flag suppresses the output of the parsed file content.
Integrated Husky (1), the tool that make Git hooks easy and can prevent
bad Git commits, pushes and more *woof*!
>>> Configuration
The configuration file `.huskyrc.js` is placed in the project root and
includes the command to run for any [upported Git hook (2). It contains
configurations for the following hooks:
- `pre-commit` - Run `lint-staged` (GH-33) before each commit to ensure
all staged files are compliant to all style guides.
References:
(1) https://github.com/typicode/husky
(2) https://github.com/typicode/husky/blob/master/DOCS.md#supported-hooks
(3) https://www.npmjs.com/package/huskyResolvesGH-34
Integrate lint-staged to run linters against staged Git files to prevent to add code that violates any style guide into the code base.
Configuration
The configuration file
lint-staged.config.js
will be placed in the project root and includes the command that should be run for matching file extensions (globs). It will include at least the three following entries with the same order as listed here:prettier --list-different
- Run Prettier (Prettier #32) against*.{js,json,md,mdx,ts,tsx,yml}
to ensure all files are formatted correctly. The--list-different
prints the found files that are not conform to the Prettier configuration.eslint
- Run ESLint (ESLint #30) against*.{js,ts,tsx}
to ensure all TypeScript and JavaScript files are compliant to the style guide after being formatted with Prettier.remark --no-stdout
- Run remark-lint (remark-lint #27) against*.md
to ensure all Markdown files are compliant to the style guide. The--no-stdout
flag suppresses the output of the parsed file content.Tasks
lint-staged.config.js
configuration file.The text was updated successfully, but these errors were encountered: