Skip to content

Commit a02e120

Browse files
committed
Create eslintrc.js
1 parent ee0084e commit a02e120

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

.eslintrc.js

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
module.exports = {
2+
root: true,
3+
env: {
4+
node: true,
5+
es6: true,
6+
},
7+
parserOptions: { ecmaVersion: 8 }, // to enable features such as async/await
8+
ignorePatterns: ['node_modules/*', '.next/*', '.out/*', '!.prettierrc.js'], // We don't want to lint generated files nor node_modules, but we want to lint .prettierrc.js (ignored by default by eslint)
9+
extends: ['eslint:recommended'],
10+
overrides: [
11+
// This configuration will apply only to TypeScript files
12+
{
13+
files: ['**/*.ts', '**/*.tsx'],
14+
parser: '@typescript-eslint/parser',
15+
settings: { react: { version: 'detect' } },
16+
env: {
17+
browser: true,
18+
node: true,
19+
es6: true,
20+
},
21+
extends: [
22+
'eslint:recommended',
23+
'plugin:@typescript-eslint/recommended', // TypeScript rules
24+
'plugin:react/recommended', // React rules
25+
'plugin:react-hooks/recommended', // React hooks rules
26+
'plugin:jsx-a11y/recommended', // Accessibility rules
27+
],
28+
rules: {
29+
// We will use TypeScript's types for component props instead
30+
'react/prop-types': 'off',
31+
32+
// No need to import React when using Next.js
33+
'react/react-in-jsx-scope': 'off',
34+
35+
// This rule is not compatible with Next.js's <Link /> components
36+
'jsx-a11y/anchor-is-valid': 'off',
37+
38+
// Why would you want unused vars?
39+
'@typescript-eslint/no-unused-vars': ['error'],
40+
41+
// I suggest this setting for requiring return types on functions only where useful
42+
'@typescript-eslint/explicit-function-return-type': [
43+
'warn',
44+
{
45+
allowExpressions: true,
46+
allowConciseArrowFunctionExpressionsStartingWithVoid: true,
47+
},
48+
],
49+
},
50+
},
51+
],
52+
}

0 commit comments

Comments
 (0)