This package contains ESLint configurations for JavaScript and TypeScript projects with React.js and Next.js. It defines linting rules to help maintain clean and consistent code. Here are the configurations and plugins included in this package:
The package includes the following configurations:
-
Environment:
- browser: true
- es2021: true
- jest: true
-
Extended from:
- 'standard'
- 'plugin:react/recommended'
- 'plugin:react-hooks/recommended'
- 'plugin:prettier/recommended'
-
Plugins:
- 'react'
- 'jsx-a11y'
- '@typescript-eslint'
- '@next/eslint-plugin-next' (for Next.js projects)
The @gildembergleite/eslint-config
package also includes the following configurations:
- settings.react: { version: 'detect' }
- 'import/parsers':
- '@typescript-eslint/parser': ['.ts', '.tsx', '.d.ts'],
To use the @gildembergleite/eslint-config
package in your project, follow the steps below:
-
Install the package as a dev dependency:
npm install --save-dev @gildembergleite/eslint-config
-
Make sure you have ESLint installed in your project:
npm install --save-dev eslint
-
Create an
.eslintrc.json
file in the root of your project (or update the existing one) and add the following content:For Next.js projects:
{ "extends": [ "@gildembergleite/eslint-config/next", "next/core-web-vitals" ] }
For React.js projects:
{ "extends": [ "@gildembergleite/eslint-config/react" ] }
-
You also need to have Prettier installed to leverage the configurations provided by the package. If you don't have Prettier installed yet, run the following command:
npm install --save-dev prettier
-
Great! Now you can run ESLint on your code using the following command:
npx eslint .
This will run linting on all files in the current directory.
Remember that you can further customize the ESLint configurations as needed to meet the specific requirements of your project.