Skip to content

Commit 35a6e6b

Browse files
committed
build(eslint): enabled eslint for .storybook
eslint ignores dotfiles by default. also enabled use of cache
1 parent 349227b commit 35a6e6b

9 files changed

+63
-64
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ dist/
33
lib/
44
coverage/
55
.nyc_output/
6+
7+
.eslintcache

.storybook/.eslintrc.yml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
rules:
2+
import/no-extraneous-dependencies: off

.storybook/config.js

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
import { configure, setAddon } from '@kadira/storybook';
1+
import {configure, setAddon} from '@kadira/storybook';
22
import infoAddon from '@kadira/react-storybook-addon-info';
33

4-
setAddon(infoAddon);
5-
64
import '../src/theme/bootstrap-custom.scss';
75

6+
setAddon(infoAddon);
7+
88
function loadAtoms() {
9-
require('../stories/atoms/loading-indicators.js');
9+
require('../stories/atoms/loading-indicators.js');
1010
}
1111

1212
function loadStories() {
13-
loadAtoms();
13+
loadAtoms();
1414

15-
require('../stories/primary-nav');
16-
require('../stories/index');
17-
require('../stories/resource-list');
18-
require('../stories/resource');
19-
require('../stories/errors');
15+
require('../stories/primary-nav');
16+
require('../stories/index');
17+
require('../stories/resource-list');
18+
require('../stories/resource');
19+
require('../stories/errors');
2020
}
2121

2222
configure(loadStories, module);

.storybook/facade-mocha.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {describe as describeReal, it as itReal} from 'storybook-addon-specifications';
22

33
module.exports = {
4-
describe: global.describe || describeReal,
5-
it: global.it || itReal
4+
describe: global.describe || describeReal,
5+
it: global.it || itReal
66
};

.storybook/facade-storybook.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import {storiesOf as storiesOfReal, action as actionReal, linkTo as linkToReal} from '@kadira/storybook';
22
import {specs as specsReal} from 'storybook-addon-specifications';
33

4-
export const
5-
storiesOf = storiesOfReal,
6-
action = actionReal,
7-
linkTo = linkToReal,
8-
specs = specsReal;
4+
export const storiesOf = storiesOfReal;
5+
export const action = actionReal;
6+
export const linkTo = linkToReal;
7+
export const specs = specsReal;

.storybook/mocha-config.js

+3-7
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ storybookFacade.specs = specs;
77

88
function setupDom() {
99
const jsdom = new JSDOM('<!doctype html><html><body></body></html>');
10-
const { window } = jsdom;
10+
const {window} = jsdom;
1111

1212
function copyProps(src, target) {
1313
const props = Object.getOwnPropertyNames(src)
14-
.filter(prop => typeof target[prop] === 'undefined')
14+
.filter(prop => 'undefined' === typeof target[prop])
1515
.map(prop => Object.getOwnPropertyDescriptor(src, prop));
1616
Object.defineProperties(target, props);
1717
}
@@ -26,8 +26,4 @@ function setupDom() {
2626

2727
setupDom();
2828

29-
require.extensions['.scss'] = (module) => {
30-
module.exports = {};
31-
32-
return module;
33-
};
29+
require.extensions['.scss'] = module => ({...module, exports: {}});

.storybook/storybook-stub.js

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
export function storiesOf() {
2-
const api = {};
3-
api.add = (name, func) => {
4-
func();
5-
return api;
6-
};
7-
api.addWithInfo = (name, desc, func) => {
8-
func();
9-
return api;
10-
};
11-
api.addDecorator = (func) => {
12-
func(() => undefined);
13-
return api;
14-
};
2+
const api = {};
3+
api.add = (name, func) => {
4+
func();
155
return api;
6+
};
7+
api.addWithInfo = (name, desc, func) => {
8+
func();
9+
return api;
10+
};
11+
api.addDecorator = func => {
12+
func(() => undefined);
13+
return api;
14+
};
15+
return api;
1616
}
1717

1818
export function specs(spec) {
19-
spec();
19+
spec();
2020
}

.storybook/webpack.config.js

+25-25
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
module.exports = {
2-
devtool: 'inline-source-map',
3-
module: {
4-
loaders: [
5-
{
6-
test: /bootstrap-custom\.scss$/,
7-
loaders: ['style', 'css?sourceMap', 'sass?sourceMap']
8-
},
9-
{
10-
test: /\.scss$/,
11-
exclude: /bootstrap-custom\.scss$/,
12-
loaders: ['style', 'css?modules&sourceMap', 'sass?sourceMap']
13-
},
14-
{
15-
test: /\.(png|woff|woff2|eot|ttf|svg)(\?v=d+\.d+\.d+)?$/,
16-
loader: 'url'
17-
}
18-
]
19-
},
20-
externals: {
21-
'jsdom': 'window',
22-
'cheerio': 'window',
23-
'react/lib/ExecutionEnvironment': true,
24-
'react/lib/ReactContext': 'window',
25-
'react/addons': true
26-
}
2+
devtool: 'inline-source-map',
3+
module: {
4+
loaders: [
5+
{
6+
test: /bootstrap-custom\.scss$/,
7+
loaders: ['style', 'css?sourceMap', 'sass?sourceMap']
8+
},
9+
{
10+
test: /\.scss$/,
11+
exclude: /bootstrap-custom\.scss$/,
12+
loaders: ['style', 'css?modules&sourceMap', 'sass?sourceMap']
13+
},
14+
{
15+
test: /\.(png|woff|woff2|eot|ttf|svg)(\?v=d+\.d+\.d+)?$/,
16+
loader: 'url'
17+
}
18+
]
19+
},
20+
externals: {
21+
jsdom: 'window',
22+
cheerio: 'window',
23+
'react/lib/ExecutionEnvironment': true,
24+
'react/lib/ReactContext': 'window',
25+
'react/addons': true
26+
}
2727
};

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"clean": "rimraf dist/ lib/",
77
"copy:scss": "cpy '**/*.scss' '../lib/' --parents --cwd=src/",
88
"lint:md": "globstar --node -- markdownlint **/*.md",
9-
"lint:js": "eslint .",
9+
"lint:js": "eslint . .storybook --cache",
1010
"lint:sass": "sass-lint src/**/*.scss",
1111
"test": "run-s lint:* test:*",
1212
"test:unit": "mocha --recursive test/unit -r ./test/helpers/mocha-setup.js",

0 commit comments

Comments
 (0)