Skip to content

Commit

Permalink
[eslint] enforce import plugin rules (#6923)
Browse files Browse the repository at this point in the history
* [eslint] use webpackBaseConfig.js for resolution instead of dev.
* [eslint] docs webpack configs must ignore non-existent build artifact
  • Loading branch information
rosskevin committed May 23, 2017
1 parent cc591b1 commit 0e6f8d9
Show file tree
Hide file tree
Showing 94 changed files with 243 additions and 94 deletions.
9 changes: 3 additions & 6 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module.exports = {
settings: {
'import/resolver': {
webpack: {
config: 'webpack.config.js',
config: './docs/webpackBaseConfig.js',
},
},
},
Expand All @@ -49,12 +49,9 @@ module.exports = {

'babel/object-curly-spacing': ['error', 'always'],

'import/unambiguous': 'off',
'import/no-unresolved': 'off',
'import/no-named-as-default': 'off',
'import/extensions': 'off',
'import/unambiguous': 'off', // scripts
'import/namespace': ['error', { allowComputed: true }],
'import/no-extraneous-dependencies': 'off',
'import/prefer-default-export': 'off',

'react/jsx-handler-names': ['error', { // airbnb is disabling this rule
eventHandlerPrefix: 'handle',
Expand Down
9 changes: 9 additions & 0 deletions docs/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
settings: {
'import/resolver': {
webpack: {
config: './webpackBaseConfig.js',
},
},
},
};
1 change: 1 addition & 0 deletions docs/src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// @flow
/* eslint-disable import/prefer-default-export */

import { AppContainer } from 'react-hot-loader';
import { createStore } from 'redux';
Expand Down
1 change: 1 addition & 0 deletions docs/webpack.dev.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// @flow weak
/* eslint-disable import/no-unresolved */

const webpack = require('webpack');
const webpackBaseConfig = require('./webpackBaseConfig');
Expand Down
2 changes: 2 additions & 0 deletions docs/webpack.prod.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// @flow weak
/* eslint-disable import/no-unresolved */

const webpack = require('webpack');
const webpackBaseConfig = require('./webpackBaseConfig');
const dllManifest = require('./build/dll.manifest.json');
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
"enzyme": "^2.8.2",
"eslint": "^3.19.0",
"eslint-config-airbnb": "^15.0.0",
"eslint-import-resolver-webpack": "^0.8.1",
"eslint-plugin-babel": "^4.1.1",
"eslint-plugin-flowtype": "^2.33.0",
"eslint-plugin-import": "^2.2.0",
Expand Down
14 changes: 14 additions & 0 deletions packages/material-ui-icons/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = {
settings: {
'import/resolver': {
webpack: {
config: '../../docs/webpackBaseConfig.js',
},
},
},
rules: {
// needed for mustache and temp
'import/no-unresolved': 'off',
'import/extensions': 'off',
}
};
2 changes: 1 addition & 1 deletion src/AppBar/AppBar.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import React from 'react';
import { assert } from 'chai';
import { createShallow } from 'src/test-utils';
import { createShallow } from '../test-utils';
import AppBar, { styleSheet } from './AppBar';

describe('<AppBar />', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/Avatar/Avatar.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import React from 'react';
import { assert } from 'chai';
import { createShallow } from 'src/test-utils';
import { createShallow } from '../test-utils';
import Avatar, { styleSheet } from './Avatar';
import CancelIcon from '../svg-icons/cancel';

Expand Down
2 changes: 1 addition & 1 deletion src/Badge/Badge.spec.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// @flow

import React from 'react';
import { createShallow } from 'src/test-utils';
import { assert } from 'chai';
import { createShallow } from '../test-utils';
import Badge, { styleSheet } from './Badge';

describe('<Badge />', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/BottomNavigation/BottomNavigation.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import React from 'react';
import { assert } from 'chai';
import { spy } from 'sinon';
import { createShallow, createMount } from 'src/test-utils';
import { createShallow, createMount } from '../test-utils';
import BottomNavigation, { styleSheet } from './BottomNavigation';
import BottomNavigationButton from './BottomNavigationButton';
import Icon from '../Icon';
Expand Down
2 changes: 1 addition & 1 deletion src/BottomNavigation/BottomNavigationButton.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import React from 'react';
import { assert } from 'chai';
import { spy } from 'sinon';
import { createShallow } from 'src/test-utils';
import { createShallow } from '../test-utils';
import BottomNavigationButton, { styleSheet } from './BottomNavigationButton';
import Icon from '../Icon';

Expand Down
2 changes: 1 addition & 1 deletion src/Button/Button.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import React from 'react';
import { assert } from 'chai';
import htmlLooksLike from 'html-looks-like';
import { createShallow, createRenderToString } from 'src/test-utils';
import { createShallow, createRenderToString } from '../test-utils';
import Button, { styleSheet } from './Button';

describe('<Button />', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/Card/Card.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import React from 'react';
import { assert } from 'chai';
import { createShallow } from 'src/test-utils';
import { createShallow } from '../test-utils';
import Card, { styleSheet } from './Card';

describe('<Card />', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/Card/CardActions.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import React from 'react';
import { assert } from 'chai';
import { createShallow } from 'src/test-utils';
import { createShallow } from '../test-utils';
import CardActions, { styleSheet } from './CardActions';

describe('<CardActions />', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/Card/CardContent.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import React from 'react';
import { assert } from 'chai';
import { createShallow } from 'src/test-utils';
import { createShallow } from '../test-utils';
import CardContent, { styleSheet } from './CardContent';

describe('<CardContent />', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/Card/CardHeader.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import React from 'react';
import { assert } from 'chai';
import { createShallow } from 'src/test-utils';
import { createShallow } from '../test-utils';
import CardHeader, { styleSheet } from './CardHeader';

describe('<CardHeader />', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/Card/CardMedia.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import React from 'react';
import { assert } from 'chai';
import { createShallow } from 'src/test-utils';
import { createShallow } from '../test-utils';
import CardMedia, { styleSheet } from './CardMedia';

describe('<CardMedia />', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/Checkbox/Checkbox.spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @flow

import { assert } from 'chai';
import { createShallow } from 'src/test-utils';
import { createShallow } from '../test-utils';
import Checkbox, { LabelCheckbox, styleSheet } from './Checkbox';

describe('<Checkbox />', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/Chip/Chip.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import React from 'react';
import keycode from 'keycode';
import { assert } from 'chai';
import { spy } from 'sinon';
import { createShallow } from 'src/test-utils';
import { createShallow } from '../test-utils';
import Chip, { styleSheet } from './Chip';
import Avatar from '../Avatar';

Expand Down
2 changes: 1 addition & 1 deletion src/Dialog/Dialog.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import React from 'react';
import { assert } from 'chai';
import { createShallow } from 'src/test-utils';
import { createShallow } from '../test-utils';
import Dialog, { styleSheet } from './Dialog';
import Paper from '../Paper';

Expand Down
2 changes: 1 addition & 1 deletion src/Dialog/DialogActions.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import React from 'react';
import { assert } from 'chai';
import { createShallow } from 'src/test-utils';
import { createShallow } from '../test-utils';
import DialogActions, { styleSheet } from './DialogActions';

describe('<DialogActions />', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/Dialog/DialogContent.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import React from 'react';
import { assert } from 'chai';
import { createShallow } from 'src/test-utils';
import { createShallow } from '../test-utils';
import DialogContent, { styleSheet } from './DialogContent';

describe('<DialogContent />', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/Dialog/DialogContentText.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import React from 'react';
import { assert } from 'chai';
import { createShallow } from 'src/test-utils';
import { createShallow } from '../test-utils';
import DialogContentText, { styleSheet } from './DialogContentText';

describe('<DialogContentText />', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/Dialog/DialogTitle.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import React from 'react';
import { assert } from 'chai';
import { createShallow } from 'src/test-utils';
import { createShallow } from '../test-utils';
import DialogTitle, { styleSheet } from './DialogTitle';

describe('<DialogTitle />', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/Dialog/withResponsiveFullScreen.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import React from 'react';
import { assert } from 'chai';
import { createShallow } from 'src/test-utils';
import { createShallow } from '../test-utils';
import Paper from '../Paper';
import Dialog, { styleSheet } from './Dialog';
import withResponsiveFullScreen from './withResponsiveFullScreen';
Expand Down
2 changes: 1 addition & 1 deletion src/Divider/Divider.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import React from 'react';
import { assert } from 'chai';
import { createShallow } from 'src/test-utils';
import { createShallow } from '../test-utils';
import Divider, { styleSheet } from './Divider';

describe('<Divider />', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/Drawer/Drawer.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import React from 'react';
import { assert } from 'chai';
import { createShallow } from 'src/test-utils';
import { createShallow } from '../test-utils';
import Drawer, { styleSheet } from './Drawer';
import Slide from '../transitions/Slide';
import Modal from '../internal/Modal';
Expand Down
2 changes: 1 addition & 1 deletion src/Form/FormControl.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import React from 'react';
import { assert } from 'chai';
import { createShallow } from 'src/test-utils';
import { createShallow } from '../test-utils';
import FormControl, { styleSheet } from './FormControl';

describe('<FormControl />', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/Form/FormGroup.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import React from 'react';
import { assert } from 'chai';
import { createShallow } from 'src/test-utils';
import { createShallow } from '../test-utils';
import FormGroup, { styleSheet } from './FormGroup';

describe('<FormGroup />', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/Form/FormLabel.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import React from 'react';
import { assert } from 'chai';
import { createShallow } from 'src/test-utils';
import { createShallow } from '../test-utils';
import FormLabel, { styleSheet } from './FormLabel';

describe('<FormLabel />', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/Grid/Grid.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import React from 'react';
import { assert } from 'chai';
import { createShallow } from 'src/test-utils';
import forOwn from 'lodash/forOwn';
import { createShallow } from '../test-utils';
import Grid, { styleSheet } from './Grid';
import Hidden from '../Hidden';

Expand Down
2 changes: 1 addition & 1 deletion src/Hidden/Hidden.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import React from 'react';
import { assert } from 'chai';
import { createShallow } from 'src/test-utils';
import { createShallow } from '../test-utils';
import Hidden from './Hidden';
import HiddenJs from './HiddenJs';

Expand Down
2 changes: 1 addition & 1 deletion src/Hidden/HiddenJs.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import React from 'react';
import { assert } from 'chai';
import { createShallow } from 'src/test-utils';
import { createShallow } from '../test-utils';
import HiddenJs from './HiddenJs';
import type { Breakpoint } from '../styles/breakpoints';
import Typography from '../Typography';
Expand Down
2 changes: 1 addition & 1 deletion src/Icon/Icon.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import React from 'react';
import { assert } from 'chai';
import { createShallow } from 'src/test-utils';
import { createShallow } from '../test-utils';
import Icon, { styleSheet } from './Icon';

describe('<Icon />', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/IconButton/IconButton.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import React from 'react';
import { assert } from 'chai';
import { createShallow } from 'src/test-utils';
import { createShallow } from '../test-utils';
import IconButton, { styleSheet } from './IconButton';
import Icon from '../Icon';

Expand Down
2 changes: 1 addition & 1 deletion src/Input/Input.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import React from 'react';
import { assert } from 'chai';
import { spy } from 'sinon';
import { createShallow, createMount } from 'src/test-utils';
import { createShallow, createMount } from '../test-utils';
import Textarea from './Textarea';
import Input, { styleSheet } from './Input';

Expand Down
2 changes: 1 addition & 1 deletion src/Input/InputLabel.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import React from 'react';
import { assert } from 'chai';
import { createShallow } from 'src/test-utils';
import { createShallow } from '../test-utils';
import InputLabel, { styleSheet } from './InputLabel';

describe('<InputLabel />', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/Input/Textarea.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import React from 'react';
import { assert } from 'chai';
import { spy } from 'sinon';
import { createShallow, createMount } from 'src/test-utils';
import { createShallow, createMount } from '../test-utils';
import Textarea from './Textarea';

describe('<Textarea />', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/List/List.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import React from 'react';
import { assert } from 'chai';
import { createShallow } from 'src/test-utils';
import { createShallow } from '../test-utils';
import List, { styleSheet } from './List';
import ListSubheader from './ListSubheader';

Expand Down
2 changes: 1 addition & 1 deletion src/List/ListItem.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import React from 'react';
import { assert } from 'chai';
import { createShallow } from 'src/test-utils';
import { createShallow } from '../test-utils';
import ListItem, { styleSheet } from './ListItem';

/**
Expand Down
2 changes: 1 addition & 1 deletion src/List/ListItemAvatar.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import React from 'react';
import { assert } from 'chai';
import { createShallow } from 'src/test-utils';
import { createShallow } from '../test-utils';
import ListItemAvatar, { styleSheet } from './ListItemAvatar';
import Avatar from '../Avatar';

Expand Down

0 comments on commit 0e6f8d9

Please sign in to comment.