@itcase/lint
v1.0.16
Published
Code style linter configuration presets
Downloads
277
Readme
ITCase Lint
Presets of linter configurations
Installation
$ npm i -D @itcase/lint eslint stylelint prettier
Usage
ESLint
Create a eslint.config.mjs
configuration file in the root of your project with the following content:
import eslint from '@itcase/lint/eslint/index.js'
export default eslint
ESLint with MobX
Create a eslint.config.mjs
configuration file in the root of your project with the following content:
import eslint from '@itcase/lint/eslint/index.js'
import eslintMobx from '@itcase/lint/eslint/mobx/index.js'
export default [...eslint, ...eslintMobx]
Stylelint
Create a eslint.config.mjs
configuration file in the root of your project with the following content:
export default {
extends: ['@itcase/lint/stylelint/index.js'],
}
Prettier
Create a prettier.config.mjs
configuration file in the root of your project with the following content:
import prettier from '@itcase/lint/prettier/index.js'
export default prettier
git-hook
- Use
husky
andlint-staged
npm i -D husky lint-staged
- Create a
.lintstagedrc
configuration file in the root of your project with the following content:
{
"*.css": ["npx stylelint --fix"],
"*.(js|jsx|ts|tsx)": ["npx eslint --fix"]
}
- Add pre-commit hook in
.husky/pre-commit
#!/bin/bash
if grep --include=*.{json,css,html} --exclude-dir={dist,node_modules,bower_components,.git} -nri --color -B 1 -A 1 '<\{7\} HEAD\|^\=\.{7\}\|>\.{7\}' .; then
echo 'Fix conflicts'
exit 1
else ./node_modules/lint-staged/bin/lint-staged.js; fi