Skip to content

Commit 6079a28

Browse files
committed
chore: refactor eslint rules to use expo config
1 parent 0f7a84e commit 6079a28

File tree

1 file changed

+38
-62
lines changed

1 file changed

+38
-62
lines changed

.eslintrc.js

Lines changed: 38 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,55 @@
11
const path = require('path');
22

33
module.exports = {
4-
// Configuration for JavaScript files
5-
extends: ['@react-native-community', 'plugin:prettier/recommended'],
6-
plugins: ['unicorn'],
4+
extends: ['expo','plugin:tailwindcss/recommended', 'prettier'],
5+
plugins: [
6+
'unicorn',
7+
'@typescript-eslint',
8+
'unused-imports',
9+
'tailwindcss',
10+
'simple-import-sort',
11+
],
12+
parserOptions: {
13+
project: './tsconfig.json',
14+
},
715
rules: {
8-
'prettier/prettier': [
16+
'unicorn/filename-case': [
917
'error',
1018
{
11-
singleQuote: true,
12-
endOfLine: 'auto',
19+
case: 'kebabCase',
20+
ignore: ['/android', '/ios'],
1321
},
1422
],
15-
'unicorn/filename-case': [
23+
'max-params': ['error', 3], // Limit the number of parameters in a function to use object instead
24+
'max-lines-per-function': ['error', 70],
25+
'react/display-name': 'off',
26+
'react/no-inline-styles': 'off',
27+
'react/destructuring-assignment': 'off', // Vscode doesn't support automatically destructuring, it's a pain to add a new variable
28+
'react/require-default-props': 'off', // Allow non-defined react props as undefined
29+
'@typescript-eslint/comma-dangle': 'off', // Avoid conflict rule between Eslint and Prettier
30+
'@typescript-eslint/consistent-type-imports': 'error', // Ensure `import type` is used when it's necessary
31+
'import/prefer-default-export': 'off', // Named export is easier to refactor automatically
32+
'tailwindcss/classnames-order': [
33+
'warn',
34+
{
35+
officialSorting: true,
36+
},
37+
], // Follow the same ordering as the official plugin `prettier-plugin-tailwindcss`
38+
'simple-import-sort/imports': 'error', // Import configuration for `eslint-plugin-simple-import-sort`
39+
'simple-import-sort/exports': 'error', // Export configuration for `eslint-plugin-simple-import-sort`
40+
'@typescript-eslint/no-unused-vars': 'off',
41+
'tailwindcss/no-custom-classname': 'off',
42+
'unused-imports/no-unused-imports': 'error',
43+
'unused-imports/no-unused-vars': [
1644
'error',
1745
{
18-
case: 'kebabCase',
19-
ignore: ['/android', '/ios'],
46+
argsIgnorePattern: '^_',
47+
varsIgnorePattern: '^_',
48+
caughtErrorsIgnorePattern: '^_',
2049
},
2150
],
2251
},
2352
overrides: [
24-
// Configuration for TypeScript files
25-
{
26-
files: ['**/*.ts', '**/*.tsx', '**/*.js'],
27-
plugins: [
28-
'@typescript-eslint',
29-
'unused-imports',
30-
'tailwindcss',
31-
'simple-import-sort',
32-
],
33-
extends: [
34-
'plugin:tailwindcss/recommended',
35-
'@react-native-community',
36-
'plugin:prettier/recommended',
37-
],
38-
parserOptions: {
39-
project: './tsconfig.json',
40-
},
41-
rules: {
42-
'prettier/prettier': [
43-
'error',
44-
{
45-
singleQuote: true,
46-
endOfLine: 'auto',
47-
},
48-
],
49-
'max-params': ['error', 3], // Limit the number of parameters in a function to use object instead
50-
'max-lines-per-function': ['error', 70],
51-
'react/destructuring-assignment': 'off', // Vscode doesn't support automatically destructuring, it's a pain to add a new variable
52-
'react/require-default-props': 'off', // Allow non-defined react props as undefined
53-
'@typescript-eslint/comma-dangle': 'off', // Avoid conflict rule between Eslint and Prettier
54-
'@typescript-eslint/consistent-type-imports': 'error', // Ensure `import type` is used when it's necessary
55-
'import/prefer-default-export': 'off', // Named export is easier to refactor automatically
56-
'tailwindcss/classnames-order': [
57-
'warn',
58-
{
59-
officialSorting: true,
60-
},
61-
], // Follow the same ordering as the official plugin `prettier-plugin-tailwindcss`
62-
'simple-import-sort/imports': 'error', // Import configuration for `eslint-plugin-simple-import-sort`
63-
'simple-import-sort/exports': 'error', // Export configuration for `eslint-plugin-simple-import-sort`
64-
'@typescript-eslint/no-unused-vars': 'off',
65-
'tailwindcss/no-custom-classname': 'off',
66-
'unused-imports/no-unused-imports': 'error',
67-
'unused-imports/no-unused-vars': [
68-
'error',
69-
{
70-
argsIgnorePattern: '^_',
71-
varsIgnorePattern: '^_',
72-
caughtErrorsIgnorePattern: '^_',
73-
},
74-
],
75-
},
76-
},
7753
// Configuration for translations files (i18next)
7854
{
7955
files: ['src/translations/*.json'],

0 commit comments

Comments
 (0)