Welcome to eslint-config-productsway 👋
XO's ESLint config with TypeScript and Prettier support
Install
npx install-peerdeps --dev eslint-config-productsway
Usage
Create a .eslintrc.cjs
file in the root of your project's directory. If you are working with TypeScript, use the following configuration:
module.exports = {
extends: ['productsway/typescript'],
};
If you are working with TypeScript and React, use the following configuration:
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: ['productsway/react'],
ignorePatterns: ['dist', '.eslintrc.cjs', 'vite.config.ts'],
parserOptions: {
project: ['./tsconfig.json', './tsconfig.node.json'],
},
rules: {},
};
Configure the ESLint TypeScript parser
If your project has a TypeScript configuration, you need to configure the ESLint TypeScript parser. Include the path to your tsconfig.json
file(s) in the parserOptions.project
array, like so:
module.exports = {
extends: ['productsway/typescript'], // or 'productsway/react' for TypeScript and React
parserOptions: {
project: ['./tsconfig.json', './tsconfig.node.json'], // include all your tsconfig.json files here
}
};
Run ESLint
Open a terminal to the root of your project, and run the following command:
npx eslint . --ext .js,.jsx,.ts,.tsx
For Vite React App, you might want to include .ts and .tsx extensions, and also report unused disable directives with maximum warnings set to 0:
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
Author
👤 Huynh Duc Dung
Show your support
Give a ⭐️ if this project helped you!