- ESLint : 코드 작성 규칙 설정
- Prettier : 자동 포맷 수정
AirBnB ESLint + Prettier
ESLint와 Prettier 규칙을 맞춰 놓으면, 소스코드 작성 후 저장 시마다 코드가 자동으로 수정되도록 할 수 있다.
- https://itnext.io/how-to-replace-prettier-by-eslint-rules-21574359e041 ESLint를 Prettier랑 매칭시키기
- https://velog.io/@myungwoo/ESLint-VS-Code-에서-적용해보기 ← AirBnB 설정 적용
Prettier
ESLint
lint 끄기
.eslintrc.js
파일 수정
module.exports = { env: { browser: true, // es6: true, es2021: true, }, extends: ['airbnb', 'airbnb/hooks', 'prettier'], globals: { Atomics: 'readonly', SharedArrayBuffer: 'readonly', }, parserOptions: { ecmaFeatures: { jsx: true, }, ecmaVersion: 12, sourceType: 'module', }, plugins: ['react', 'react-hooks'], rules: { 'react-hooks/exhaustive-deps': ['off'], 'react/prop-types': ['off'], 'react-hooks/rules-of-hooks': 'error', 'no-console': ['off'], 'import/no-unresolved': 'off', 'import/prefer-default-export': ['off'], 'react/jsx-props-no-spreading': ['warn'], 'arrow-parens': ['warn', 'as-needed'], 'no-underscore-dangle': ['off'], camelcase: ['off'], 'no-alert': ['off'], 'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx'] }], 'jsx-a11y/no-noninteractive-element-interactions': ['off'], 'jsx-a11y/click-events-have-key-events': ['off'], 'jsx-a11y/control-has-associated-label': ['off'], 'jsx-a11y/no-static-element-interactions': ['off'], 'no-use-before-define': ['off'], 'arrow-body-style': ['off'], allowShortCircuit: true, }, };