2017-09-29 5 views
0

사실 웹 팩 구성 파일이 있는데, 이는 공장 기능입니다 (react-universally 상용구).eslint - webpack 별칭

나는 resolve 옵션을 추가했습니다 그것은 다음과 같습니다 : 나는 import config from 'Config'처럼 감속기에 액세스 할 수있어이 설정으로

resolve: { 
     // These extensions are tried when resolving a file. 
     extensions: config('bundleSrcTypes').map(ext => `.${ext}`), 

     // This is required for the modernizr-loader 
     // @see https://github.com/peerigon/modernizr-loader 
     alias: { 
     modernizr$: path.resolve(appRootDir.get(), './.modernizrrc'), 
     Config: path.resolve(appRootDir.get(), './config'), 
     }, 
    }, 

,하지만 내 린터 나에게 오류를 던지고있다 :

'Config' should be listed in the project's dependencies. Run 'npm i -S Config' to add it (import/no-extraneous-dependencies) 
'Config' should be listed in the project's dependencies. Run 'npm i -S Config' to add it (import/no-extraneous-dependencies) 
Missing file extension for "Config" (import/extensions) 

내 eslinter 구성에 별칭을 추가하려면 어떻게합니까? 이 문제에 대한 상위 Google 결과에 나열된 여러 패키지를 시도했지만 작동하지 않습니다. 별칭을 수동으로 .eslintrc에 추가 할 수 있습니까? 는 config 가져 오기가 특별한 예외이기 때문에

답변

0

, 당신은 당신은 import/core-modules 옵션 아래를 통해 별칭을 나열 할 수 있습니다

https://eslint.org/docs/user-guide/configuring#disabling-rules-with-inline-comments

+0

네,하지만 내가 프로젝트에있는 파일의 양을 해제에

, 그냥 악몽이다. – Ancinek

+0

불행히도'import/no-extraneous-dependencies' 규칙에는 특정 패키지에 대한 화이트리스트 또는 블랙리스트 옵션이없는 것처럼 보입니다. Github에서 플러그인에 대한 문제를 열려고 할 수 있습니다. – Sidney

1

(모든 규칙 또는 단지 하나의 규칙)이 라인을 무시 ESLint을 알 수 있습니다 설정. 이 같은 더 많은 별칭이 있기 때문에 당신의 .eslintrc

"settings": { 
    "import/core-modules": [ 
    "config-alias", 
    "another-alias" 
    ] 
}