Last active
May 15, 2023 09:55
-
-
Save seiwonpark/87b7149f5c8ef11b7e4bccc9b6780b25 to your computer and use it in GitHub Desktop.
eslint + prettier + import order for React.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
env: { | |
es2021: true, | |
node: true, | |
}, | |
parser: '@typescript-eslint/parser', | |
plugins: ['@typescript-eslint', 'prettier', 'import'], | |
extends: ['prettier'], | |
overrides: [], | |
parserOptions: { | |
ecmaVersion: 'latest', | |
sourceType: 'module', | |
}, | |
rules: { | |
'prettier/prettier': 'warn', | |
'import/order': [ | |
'error', | |
{ | |
groups: ['builtin', 'external', 'internal'], | |
pathGroups: [ | |
{ | |
pattern: 'react', | |
group: 'external', | |
position: 'before', | |
}, | |
], | |
pathGroupsExcludedImportTypes: ['react'], | |
'newlines-between': 'always', | |
alphabetize: { | |
caseInsensitive: true, | |
}, | |
}, | |
], | |
}, | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"singleQuote": true, | |
"parser": "typescript", | |
"semi": true, | |
"useTabs": false, | |
"tabWidth": 2, | |
"printWidth": 120, | |
"arrowParens": "always", | |
"importOrderCaseInsensitive": true, | |
"importOrder": [ | |
"^react$", | |
"^react-dom$", | |
"<THIRD_PARTY_MODULES>", | |
"^[./]" | |
], | |
"importOrderSeparation": true | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "", | |
"version": "0.1.0", | |
"private": true, | |
"dependencies": { | |
"@testing-library/jest-dom": "^5.16.5", | |
"@testing-library/react": "^13.4.0", | |
"@testing-library/user-event": "^13.5.0", | |
"@types/jest": "^27.5.2", | |
"@types/node": "^16.18.24", | |
"@types/react": "^18.0.38", | |
"@types/react-dom": "^18.0.11", | |
"react": "^18.2.0", | |
"react-dom": "^18.2.0", | |
"react-router-dom": "^6.10.0", | |
"react-scripts": "5.0.1", | |
"styled-components": "^5.3.10", | |
"typescript": "^4.9.5", | |
"web-vitals": "^2.1.4" | |
}, | |
"scripts": { | |
"lint": "eslint --ext **/*.{ts,tsx} **/*.{ts,tsx}", | |
"lint:fix": "eslint --ext **/*.{ts,tsx} --fix **/*.{ts,tsx}", | |
"format": "prettier --write **/*.{ts,tsx}", | |
"start": "react-scripts start", | |
"build": "react-scripts build", | |
"test": "react-scripts test", | |
"eject": "react-scripts eject" | |
}, | |
"eslintConfig": { | |
"extends": [ | |
"react-app", | |
"react-app/jest" | |
] | |
}, | |
"browserslist": { | |
"production": [ | |
">0.2%", | |
"not dead", | |
"not op_mini all" | |
], | |
"development": [ | |
"last 1 chrome version", | |
"last 1 firefox version", | |
"last 1 safari version" | |
] | |
}, | |
"devDependencies": { | |
"@trivago/prettier-plugin-sort-imports": "^4.1.1", | |
"@types/styled-components": "^5.1.26", | |
"eslint": "^8.39.0", | |
"eslint-config-prettier": "^8.8.0", | |
"eslint-plugin-prettier": "^4.2.1", | |
"prettier": "^2.8.8" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment