@prefabs.tech/eslint-config
v0.2.0
Published
ESLint config
Keywords
Readme
@prefabs.tech/eslint-config
Custom ESLint configuration for streamlined linting across projects.
Supported configurations:
@prefabs.tech/eslint-config/fastifyfastify apis and libraries@prefabs.tech/eslint-config/reactfor react libraries@prefabs.tech/eslint-config/react-appfor react apps@prefabs.tech/eslint-config/vuefor vue apps and libraries@prefabs.tech/eslint-configfor general typescript projects
Installation and usage
For fastify apis and libraries:
In the root directory of your app or package:
Install dependencies:
npm i -D @prefabs.tech/eslint-config @typescript-eslint/[email protected] @typescript-eslint/[email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] typescriptCreate a
.eslintrc.jsfile:module.exports = { root: true, extends: ["@prefabs.tech/eslint-config/fastify"], };For react libraries:
In the root directory of your the react package:
Install dependencies:
npm i -D @prefabs.tech/eslint-config @typescript-eslint/[email protected] @typescript-eslint/[email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] typescriptCreate a
.eslintrc.jsfile:module.exports = { root: true, extends: ["@prefabs.tech/eslint-config/react"], };For react apps:
In the root directory of the react app:
Install dependencies:
npm i -D @prefabs.tech/eslint-config @typescript-eslint/[email protected] @typescript-eslint/[email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] typescriptCreate a
.eslintrc.jsfile:module.exports = { root: true, extends: ["@prefabs.tech/eslint-config/react-app"], };For vue apps and libraries:
In the root directory of your app or package:
Install dependencies:
npm i -D @prefabs.tech/eslint-config @typescript-eslint/[email protected] @typescript-eslint/[email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] typescript [email protected]Create a
.eslintrc.jsfile:module.exports = { root: true, extends: ["@prefabs.tech/eslint-config/vue"], };Note: If you're using this configuration for a vue app, you may want to disable the
vue/no-reserved-component-namesrule, which prevents using reserved HTML tag names (e.g., Button, Input) as component names. You can do this by adding the following configuration:module.exports = { root: true, extends: ["@prefabs.tech/eslint-config/vue"], rules: { "vue/no-reserved-component-names": "off", } };For general typescript projects:
In the root directory of your app or package:
Install dependencies:
npm i -D @prefabs.tech/eslint-config [email protected] @typescript-eslint/[email protected] @typescript-eslint/[email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] typescriptCreate a
.eslintrc.jsfile:module.exports = { root: true, extends: ["@prefabs.tech/eslint-config"], };
Adding linting scripts
In your package.json, add the following commands to the scripts section:
For typescript or react projects:
"lint": "eslint .", "lint:fix": "eslint . --fix"For vue projects (including .vue files):
"lint": "eslint . --ext .vue", "lint:fix": "eslint . --ext .vue --fix",
Running linting
Run the following command to lint your code:
npm run lintTo automatically fix issues, run:
npm run lint:fix