Я использую ES6 реагировать и импортировать мои стили в компонент с:Eslint столпотворения подавить ошибку при импорте стилей в реакцию компонент
import styles from './MyStyle.sass';
Я пыление с eslint с этими НПМИ модулями:
"babel-eslint": "^6.1.2",
"eslint": "^3.16.0",
"eslint-plugin-react": "^6.10.0",
и вот мой (немного долго) .eslintrc.yml
файл:
---
extends:
- plugin:react/recommended
env:
browser: true
node: true
es6: true
parserOptions:
ecmaVersion: 6
sourceType: "module"
ecmaFeatures:
jsx: true
globals:
__DEV__: true
__SERVER__: true
plugins:
- react
parser: "babel-eslint"
rules:
react/jsx-uses-vars: 1
react/prop-types: [1, { ignore: [children] }]
semi: 0
key-spacing: 1
curly: 0
consistent-return: 0
space-infix-ops: 1
camelcase: 0
no-spaced-func: 1
no-alert: 1
eol-last: 1
comma-spacing: 1
eqeqeq: 1
# possible errors
comma-dangle: 0
no-cond-assign: 2
no-console: 0
no-constant-condition: 2
no-control-regex: 2
no-debugger: 2
no-dupe-args: 2
no-dupe-keys: 2
no-duplicate-case: 2
no-empty-character-class: 2
no-empty: 2
no-ex-assign: 2
no-extra-boolean-cast: 2
no-extra-parens: 0
no-extra-semi: 2
no-func-assign: 2
no-inner-declarations: 2
no-invalid-regexp: 2
no-irregular-whitespace: 2
no-negated-in-lhs: 2
no-obj-calls: 2
no-regex-spaces: 2
no-sparse-arrays: 2
no-unexpected-multiline: 2
no-unreachable: 2
use-isnan: 2
valid-jsdoc: 2
valid-typeof: 2
no-redeclare: 2
init-declarations: 2
no-catch-shadow: 2
no-delete-var: 2
no-label-var: 2
no-shadow-restricted-names: 2
no-shadow: 2
no-undef-init: 2
no-undef: 2
no-undefined: 2
no-unused-vars: 2
no-use-before-define: 2
проблема заключается в том, что eslint жалуются, что «экспорт по умолчанию не объявлен в импортированных модулях» относительно импортированного модуля styles
.
Edit:
1) Тот же вопрос относится и к импорту таких как
import logo_img from './img/home_logo.png'
2) Конечно, я использую Webpack и стиль/дерзость/CSS/URL/грузчики
Вопрос:
Как я могу подавить это предупреждение?
Вы экспортировали default из файла стиля? –
Нет, это файл sass/css, я думаю, что babel и его загрузчики позаботятся об упаковке его в модуль – Leonardo