@4s1/eslint-config
v8.1.0
Published
ESLint and Prettier config
Downloads
397
Readme
ESLint and Prettier Config
These are settings for ESLint and Prettier.
Setup
Add ESLint, Prettier and configuration packages to your project:
# pnpm
pnpm add eslint prettier @4s1/eslint-config -D
# npm
npm install eslint prettier @4s1/eslint-config -D
Add scripts for linting into package.json
:
npm pkg set scripts.lint="eslint src/ && prettier --check ."
npm pkg set scripts.lint:fix="eslint --fix src/ && prettier --write ."
ESLint config
Create a eslint.config.mjs
file in your project root folder and add reference to the configuration:
echo "import customConfig from \"@4s1/eslint-config/eslint.config.mjs\";" > eslint.config.mjs
echo "" >> eslint.config.mjs
echo "export default customConfig;" >> eslint.config.mjs
Prettier config
Add prettier configuration into package.json
:
npm pkg set prettier="@4s1/eslint-config"
Add script command into package.json
to run prettier:
npm pkg set scripts.format="prettier --write ."
Create a .prettierignore
file in your project root folder and add some exceptions:
echo "/coverage/" > .prettierignore
echo "/dist/" >> .prettierignore
echo "/pnpm-lock.yaml" >> .prettierignore
echo "/package-lock.json" >> .prettierignore