forked from cruise-automation/webviz
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generate screenshots of stories (cruise-automation#26)
This is an intermediate step before adding https://github.com/reg-viz/reg-suit for screenshot tests. I did a few other things in this PR: - Moved inScreenshotTests files to the stories directory as we can now share code. - When doing that I ran into an issue of eslint not liking the dot in `.storybook` imports, so I renamed that directory to `stories`. Bonus: this directory now gets properly linted! - Also I had to add the root directory to webpack.config.js to be able to refer to `storybook/inScreenshotTests`. - And when doing that I discovered that eslint-import-resolver-webpack didn’t pick up the root webpack.config.js properly in some cases, so I had to change .eslintrc.yml to .eslintrc.js so I could use __dirname to explicitly point to the right file. Also I had to add the withScreenshots decorator to every story. Test plan: tested locally; verified that it runs in CI.
- Loading branch information
1 parent
8d6d83d
commit 65e472a
Showing
22 changed files
with
628 additions
and
211 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ node_modules | |
coverage | ||
build | ||
/flow-typed | ||
!.eslintrc.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
module.exports = { | ||
env: { browser: true, node: true, jest: true }, | ||
extends: [ | ||
"eslint:recommended", | ||
"plugin:jest/recommended", | ||
"plugin:react/recommended", | ||
"plugin:flowtype/recommended", | ||
"plugin:import/recommended", | ||
"problems", | ||
"plugin:prettier/recommended", | ||
"prettier/flowtype", | ||
"prettier/react", | ||
], | ||
plugins: ["jest", "import-order-alphabetical"], | ||
parser: "babel-eslint", | ||
settings: { "import/resolver": { webpack: { config: `${__dirname}/webpack.config.js` } } }, | ||
rules: { | ||
curly: "error", | ||
"prettier/prettier": "error", | ||
"no-console": ["error", { allow: ["warn", "error"] }], | ||
"no-unused-vars": ["error", { args: "none", varsIgnorePattern: "^_" }], | ||
"flowtype/no-unused-expressions": "error", | ||
"no-underscore-dangle": ["error", { allowAfterThis: true }], | ||
"react/prop-types": "off", // We use Flow instead. | ||
"no-useless-computed-key": "off", // https://github.com/facebook/flow/issues/380#issuecomment-224380551 | ||
yoda: "off", // https://github.com/RyanZim/eslint-config-problems/pull/1 and https://github.com/eslint/eslint/issues/10591 | ||
// Some good ones that people really should be adding to import/recommended: | ||
"import/first": "error", | ||
"import/no-self-import": "error", | ||
"import/no-useless-path-segments": "error", | ||
"import/no-mutable-exports": "error", | ||
"import/newline-after-import": "error", | ||
"import/no-duplicates": "error", // https://github.com/benmosher/eslint-plugin-import/issues/242#issuecomment-230118951 | ||
"no-duplicate-imports": "off", // False positives on flow type imports, so we use import/no-duplicates instead which handles them correctly. | ||
// Group imports into two groups: packages and files. Sort alphabetically | ||
// within those groups. | ||
"import-order-alphabetical/order": [ | ||
"error", | ||
{ "newlines-between": "always", groups: [["builtin", "external"], ["internal", "parent", "sibling", "index"]] }, | ||
], | ||
// TODO(JP): Fix this instead of disabling it: | ||
"import/no-named-as-default": "off", | ||
}, | ||
}; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.