From 7c4f87b68c2e59ecb51b4f9dd85e7aae3cb51c99 Mon Sep 17 00:00:00 2001 From: hypnos Date: Thu, 28 Dec 2017 04:38:46 +0300 Subject: [PATCH] Add more `imports` eslint rules --- .eslintrc.js | 4 ++++ addons/a11y/package.json | 1 + addons/actions/package.json | 1 + addons/background/package.json | 1 + addons/centered/package.json | 1 + addons/events/package.json | 1 + addons/graphql/package.json | 1 + addons/info/package.json | 1 + addons/info/src/components/markdown/index.js | 2 +- addons/jest/package.json | 1 + addons/knobs/package.json | 1 + addons/links/package.json | 1 + addons/notes/package.json | 1 + addons/storyshots/package.json | 1 + addons/viewport/package.json | 2 +- addons/viewport/src/index.js | 1 - app/angular/package.json | 1 + app/react-native/package.json | 1 + app/react/package.json | 1 + app/vue/package.json | 1 + docs/src/stories/index.js | 2 ++ examples/cra-kitchen-sink/src/stories/index.stories.js | 1 + examples/official-storybook/stories/addon-notes.stories.js | 1 + lib/addons/package.json | 1 + lib/channel-postmessage/package.json | 1 + lib/channel-websocket/package.json | 1 + lib/channels/package.json | 1 + lib/client-logger/package.json | 1 + lib/codemod/package.json | 1 + lib/components/package.json | 1 + lib/node-logger/package.json | 1 + lib/ui/package.json | 1 + 32 files changed, 35 insertions(+), 3 deletions(-) delete mode 100644 addons/viewport/src/index.js diff --git a/.eslintrc.js b/.eslintrc.js index 4fa3bf4ddff9..ec55d7a46309 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -17,6 +17,7 @@ module.exports = { }, settings: { 'import/core-modules': ['enzyme'], + 'import/ignore': ['node_modules\\/(?!@storybook)'], }, rules: { strict: [error, 'never'], @@ -60,6 +61,9 @@ module.exports = { }, ], 'import/prefer-default-export': ignore, + 'import/default': error, + 'import/named': error, + 'import/namespace': error, 'react/jsx-wrap-multilines': ignore, 'react/jsx-indent': ignore, 'react/jsx-indent-props': ignore, diff --git a/addons/a11y/package.json b/addons/a11y/package.json index 2658ccf8a039..afdd8fea5dbc 100644 --- a/addons/a11y/package.json +++ b/addons/a11y/package.json @@ -16,6 +16,7 @@ }, "license": "MIT", "main": "dist/index.js", + "jsnext:main": "src/index.js", "repository": { "type": "git", "url": "git+https://github.com/storybooks/storybook.git" diff --git a/addons/actions/package.json b/addons/actions/package.json index 12a3e6879d57..19fdac634d5f 100644 --- a/addons/actions/package.json +++ b/addons/actions/package.json @@ -11,6 +11,7 @@ }, "license": "MIT", "main": "dist/index.js", + "jsnext:main": "src/index.js", "repository": { "type": "git", "url": "https://github.com/storybooks/storybook.git" diff --git a/addons/background/package.json b/addons/background/package.json index 96b3e2ee0ffa..ef985c2043aa 100644 --- a/addons/background/package.json +++ b/addons/background/package.json @@ -15,6 +15,7 @@ "license": "MIT", "author": "jbaxleyiii", "main": "dist/index.js", + "jsnext:main": "src/index.js", "repository": { "type": "git", "url": "https://github.com/storybooks/storybook.git" diff --git a/addons/centered/package.json b/addons/centered/package.json index ff8901e9e476..a920ed93e4e3 100644 --- a/addons/centered/package.json +++ b/addons/centered/package.json @@ -5,6 +5,7 @@ "license": "MIT", "author": "Muhammed Thanish ", "main": "dist/index.js", + "jsnext:main": "src/index.js", "scripts": { "prepare": "node ../../scripts/prepare.js" }, diff --git a/addons/events/package.json b/addons/events/package.json index d367af743696..989f0b05af1d 100644 --- a/addons/events/package.json +++ b/addons/events/package.json @@ -10,6 +10,7 @@ ], "license": "MIT", "main": "dist/index.js", + "jsnext:main": "src/index.js", "repository": { "type": "git", "url": "git@github.com:storybooks/storybook.git" diff --git a/addons/graphql/package.json b/addons/graphql/package.json index ca16705375eb..1bcadb518019 100644 --- a/addons/graphql/package.json +++ b/addons/graphql/package.json @@ -11,6 +11,7 @@ }, "license": "MIT", "main": "dist/index.js", + "jsnext:main": "src/index.js", "repository": { "type": "git", "url": "https://github.com/storybooks/storybook.git" diff --git a/addons/info/package.json b/addons/info/package.json index 1d80fa218dfe..b4c9f5f099be 100644 --- a/addons/info/package.json +++ b/addons/info/package.json @@ -4,6 +4,7 @@ "description": "A Storybook addon to show additional information for your stories.", "license": "MIT", "main": "dist/index.js", + "jsnext:main": "src/index.js", "repository": { "type": "git", "url": "https://github.com/storybooks/storybook.git" diff --git a/addons/info/src/components/markdown/index.js b/addons/info/src/components/markdown/index.js index e3a39005f78b..2c9ff6ea3064 100644 --- a/addons/info/src/components/markdown/index.js +++ b/addons/info/src/components/markdown/index.js @@ -1,3 +1,3 @@ export { H1, H2, H3, H4, H5, H6 } from './htags'; export { Code, Pre } from './code'; -export { P, Small, A, LI, UL } from './text'; +export { P, A, LI, UL } from './text'; diff --git a/addons/jest/package.json b/addons/jest/package.json index 148a6653adac..27f029fba137 100644 --- a/addons/jest/package.json +++ b/addons/jest/package.json @@ -16,6 +16,7 @@ "license": "MIT", "author": "Renaud Tertrais (https://github.com/renaudtertrais)", "main": "dist/index.js", + "jsnext:main": "src/index.js", "repository": { "type": "git", "url": "git+https://github.com/storybooks/storybook" diff --git a/addons/knobs/package.json b/addons/knobs/package.json index 776ab9a9c2a3..a0be8f759a31 100644 --- a/addons/knobs/package.json +++ b/addons/knobs/package.json @@ -4,6 +4,7 @@ "description": "Storybook Addon Prop Editor Component", "license": "MIT", "main": "dist/index.js", + "jsnext:main": "src/index.js", "repository": { "type": "git", "url": "https://github.com/storybooks/storybook.git" diff --git a/addons/links/package.json b/addons/links/package.json index f631c0c789cf..3a37030dcba3 100644 --- a/addons/links/package.json +++ b/addons/links/package.json @@ -11,6 +11,7 @@ }, "license": "MIT", "main": "dist/index.js", + "jsnext:main": "src/index.js", "repository": { "type": "git", "url": "https://github.com/storybooks/storybook.git" diff --git a/addons/notes/package.json b/addons/notes/package.json index 09aa14b27d72..bd782f186d57 100644 --- a/addons/notes/package.json +++ b/addons/notes/package.json @@ -9,6 +9,7 @@ ], "license": "MIT", "main": "dist/index.js", + "jsnext:main": "src/index.js", "repository": { "type": "git", "url": "https://github.com/storybooks/storybook.git" diff --git a/addons/storyshots/package.json b/addons/storyshots/package.json index c6364f6bbccb..c57f71f3b3ee 100644 --- a/addons/storyshots/package.json +++ b/addons/storyshots/package.json @@ -4,6 +4,7 @@ "description": "StoryShots is a Jest Snapshot Testing Addon for Storybook.", "license": "MIT", "main": "dist/index.js", + "jsnext:main": "src/index.js", "repository": { "type": "git", "url": "https://github.com/storybooks/storybook.git" diff --git a/addons/viewport/package.json b/addons/viewport/package.json index 90c89fd9a890..8ee87d43d31b 100644 --- a/addons/viewport/package.json +++ b/addons/viewport/package.json @@ -2,7 +2,7 @@ "name": "@storybook/addon-viewport", "version": "3.3.1", "description": "Storybook addon to change the viewport size to mobile", - "main": "dist/index.js", + "main": "register.js", "keywords": [ "storybook" ], diff --git a/addons/viewport/src/index.js b/addons/viewport/src/index.js deleted file mode 100644 index d3da40ad9193..000000000000 --- a/addons/viewport/src/index.js +++ /dev/null @@ -1 +0,0 @@ -export { register } from './manager'; diff --git a/app/angular/package.json b/app/angular/package.json index 49437b06e772..60450f16b49f 100644 --- a/app/angular/package.json +++ b/app/angular/package.json @@ -8,6 +8,7 @@ }, "license": "MIT", "main": "dist/client/index.js", + "jsnext:main": "src/client/index.js", "bin": { "build-storybook": "./bin/build.js", "start-storybook": "./bin/index.js", diff --git a/app/react-native/package.json b/app/react-native/package.json index 39e7b6180b8d..c49ee295cc94 100644 --- a/app/react-native/package.json +++ b/app/react-native/package.json @@ -13,6 +13,7 @@ }, "license": "MIT", "main": "dist/index.js", + "jsnext:main": "src/index.js", "bin": { "storybook": "dist/bin/storybook.js" }, diff --git a/app/react/package.json b/app/react/package.json index 7cbe97363888..f7317b1989ae 100644 --- a/app/react/package.json +++ b/app/react/package.json @@ -8,6 +8,7 @@ }, "license": "MIT", "main": "dist/client/index.js", + "jsnext:main": "src/client/index.js", "bin": { "build-storybook": "./bin/build.js", "start-storybook": "./bin/index.js", diff --git a/app/vue/package.json b/app/vue/package.json index 313f3a1a18fb..e93da1df4330 100644 --- a/app/vue/package.json +++ b/app/vue/package.json @@ -8,6 +8,7 @@ }, "license": "MIT", "main": "dist/client/index.js", + "jsnext:main": "src/client/index.js", "bin": { "build-storybook": "./bin/build.js", "start-storybook": "./bin/index.js", diff --git a/docs/src/stories/index.js b/docs/src/stories/index.js index 66d0b46edde4..f9d8240f38aa 100644 --- a/docs/src/stories/index.js +++ b/docs/src/stories/index.js @@ -1,3 +1,5 @@ +// TODO reenable when @storybook/react with jsnext:main is published +// eslint-disable-next-line import/named import { storiesOf } from '@storybook/react'; import implementations from './implementations'; diff --git a/examples/cra-kitchen-sink/src/stories/index.stories.js b/examples/cra-kitchen-sink/src/stories/index.stories.js index 075f25bb704a..cebb63b19aed 100644 --- a/examples/cra-kitchen-sink/src/stories/index.stories.js +++ b/examples/cra-kitchen-sink/src/stories/index.stories.js @@ -3,6 +3,7 @@ import React from 'react'; import { storiesOf } from '@storybook/react'; import { setOptions } from '@storybook/addon-options'; import { action } from '@storybook/addon-actions'; +// eslint-disable-next-line import/named import { withNotes, WithNotes } from '@storybook/addon-notes'; import centered from '@storybook/addon-centered'; import { withInfo } from '@storybook/addon-info'; diff --git a/examples/official-storybook/stories/addon-notes.stories.js b/examples/official-storybook/stories/addon-notes.stories.js index f6c850dddfeb..b4b67686fd3e 100644 --- a/examples/official-storybook/stories/addon-notes.stories.js +++ b/examples/official-storybook/stories/addon-notes.stories.js @@ -1,6 +1,7 @@ import React from 'react'; import { storiesOf } from '@storybook/react'; +// eslint-disable-next-line import/named import { withNotes, WithNotes } from '@storybook/addon-notes'; import { action } from '@storybook/addon-actions'; import BaseButton from '../components/BaseButton'; diff --git a/lib/addons/package.json b/lib/addons/package.json index 0f623bfda443..6e6b9a95ab14 100644 --- a/lib/addons/package.json +++ b/lib/addons/package.json @@ -11,6 +11,7 @@ }, "license": "MIT", "main": "dist/index.js", + "jsnext:main": "src/index.js", "repository": { "type": "git", "url": "https://github.com/storybooks/storybook.git" diff --git a/lib/channel-postmessage/package.json b/lib/channel-postmessage/package.json index e20e4316e454..e33263a9199a 100644 --- a/lib/channel-postmessage/package.json +++ b/lib/channel-postmessage/package.json @@ -4,6 +4,7 @@ "description": "", "license": "MIT", "main": "dist/index.js", + "jsnext:main": "src/index.js", "scripts": { "prepare": "node ../../scripts/prepare.js" }, diff --git a/lib/channel-websocket/package.json b/lib/channel-websocket/package.json index b48a9132ba15..82ce1aae4015 100644 --- a/lib/channel-websocket/package.json +++ b/lib/channel-websocket/package.json @@ -4,6 +4,7 @@ "description": "", "license": "MIT", "main": "dist/index.js", + "jsnext:main": "src/index.js", "scripts": { "prepare": "node ../../scripts/prepare.js" }, diff --git a/lib/channels/package.json b/lib/channels/package.json index b51a6d5c33ba..eaf7b69ceb3f 100644 --- a/lib/channels/package.json +++ b/lib/channels/package.json @@ -4,6 +4,7 @@ "description": "", "license": "MIT", "main": "dist/index.js", + "jsnext:main": "src/index.js", "scripts": { "prepare": "node ../../scripts/prepare.js" } diff --git a/lib/client-logger/package.json b/lib/client-logger/package.json index 827a45d34977..6e649dbc8e0c 100644 --- a/lib/client-logger/package.json +++ b/lib/client-logger/package.json @@ -4,6 +4,7 @@ "description": "", "license": "MIT", "main": "dist/index.js", + "jsnext:main": "src/index.js", "scripts": { "prepare": "node ../../scripts/prepare.js" } diff --git a/lib/codemod/package.json b/lib/codemod/package.json index 9fca264145c8..1b97c73ea202 100644 --- a/lib/codemod/package.json +++ b/lib/codemod/package.json @@ -4,6 +4,7 @@ "description": "A collection of codemod scripts written with JSCodeshift", "license": "MIT", "main": "dist/index.js", + "jsnext:main": "src/index.js", "repository": { "type": "git", "url": "https://github.com/storybooks/storybook.git" diff --git a/lib/components/package.json b/lib/components/package.json index 54ef66ab3181..0797046557f4 100644 --- a/lib/components/package.json +++ b/lib/components/package.json @@ -4,6 +4,7 @@ "description": "Core Storybook Components", "license": "MIT", "main": "dist/index.js", + "jsnext:main": "src/index.js", "repository": { "type": "git", "url": "https://github.com/storybooks/storybook.git" diff --git a/lib/node-logger/package.json b/lib/node-logger/package.json index a6b379dff7dc..edfc72000884 100644 --- a/lib/node-logger/package.json +++ b/lib/node-logger/package.json @@ -4,6 +4,7 @@ "description": "", "license": "MIT", "main": "dist/index.js", + "jsnext:main": "src/index.js", "scripts": { "prepare": "node ../../scripts/prepare.js" }, diff --git a/lib/ui/package.json b/lib/ui/package.json index fcca24c6ee8c..9daa5256fd86 100644 --- a/lib/ui/package.json +++ b/lib/ui/package.json @@ -4,6 +4,7 @@ "description": "Core Storybook UI", "license": "MIT", "main": "dist/index.js", + "jsnext:main": "src/index.js", "repository": { "type": "git", "url": "https://github.com/storybooks/storybook.git"