Eslint-plugin-import
ESLint plugin with rules that help validate proper imports.
Usage
--fix 옵션을 사용하면 된다.
함께 설치할 것듯
블로그 같은곳 보면 항상 함께 설치하는데 설명이 없는 내용들:
- eslint-import-resolver-typescript - Typescript import 순서 자동 정렬 (TypeScript 적용을 위해 필요)
- eslint-import-resolver-webpack - Webpack 모듈. "동기식 (synchronous)" 설정만 적용 가능.
무지성 설치:
Sample settings
module.exports = {
...,
settings: {
'import/parsers': { '@typescript-eslint/parser': ['.ts'] },
},
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:import/typescript',
'plugin:import/recommended',
],
rules: {
...,
'import/order': [
'error',
{
groups: ['builtin', 'external', ['parent', 'sibling'], 'index'],
pathGroups: [
{
pattern: 'angular',
group: 'external',
position: 'before'
}
],
alphabetize: {
order: 'asc',
caseInsensitive: true,
},
'newlines-between': 'always',
},
],
}
}