-
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.
feat(react): add support for react (#11)
* feat(react): add support for react - initial dev Still need some adjustments, but the basic dev workflow is working * feat(react): check required files before building and start of prod mode * Now it is checked if the following files are present: `public/index.html` or one of the following`src/index.tsx` or `src/index.js`. If one of them is missing, it should throw and stop the build * Start of the prod build (added just the stubs, but the config is still the same as the dev one) * feat(react): added webpack config for production and ts config for web * feat(react): better report on the prod build * feat(react): added option to generate webpack's bundle stats * feat(react): make scripts throw on unhandled rejections * feat(react): add a better error overlay to the dev server Use the same overlay that create-react-app uses 😁 * feat(react): add WatchMissingNodeModulesPlugin and ModuleScopePlugin * feat(react): better reporting for the dev builds * feat(react): added required files to the npm final build * feat(react): moved deps that were wrongly put on devDeps * feat(react): added some missing config on eslint.web * feat(react): removed WatchMissingNodeModulesPlugin It was being problematic on the published package (was fine on local dev though 🤷♂️) * feat(react): fixed coverage collection on ts files * feat(react): removed the babel-core bridge requirement Apparently, it no longer errors when not installed. * feat(react): added some missing eslint settings * feat(react): allow custom babel config for the webpack builds User-suplied babel config must be a `.babel.js` file. * style(lint): change double quotes to single quotes * chore: change the default output dir to 'dist' * feat(react): "fix" eslint errors when using React.Fragment
- Loading branch information
1 parent
911ed90
commit 5976488
Showing
29 changed files
with
5,910 additions
and
604 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
module.exports = require("./src/config/eslintrc") | ||
module.exports = require("./src/config/eslintrc.base") |
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 |
---|---|---|
@@ -1 +1 @@ | ||
module.exports = require('./dist/config/eslintrc') | ||
module.exports = require('./dist/config/eslintrc.base') |
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 @@ | ||
module.exports = require('./dist/config/eslintrc.web') |
Large diffs are not rendered by default.
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
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 @@ | ||
declare module 'react-dev-utils/*' |
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,3 @@ | ||
declare const createBabelConfig: () => any | ||
|
||
export default createBabelConfig |
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
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,221 @@ | ||
// @ts-check | ||
const baseConfig = require('./eslintrc.base') | ||
|
||
const config = { | ||
...baseConfig, | ||
plugins: [...baseConfig.plugins, 'react', 'jsx-a11y'], | ||
parserOptions: { | ||
...baseConfig.parserOptions, | ||
ecmaFeatures: { | ||
...baseConfig.parserOptions.ecmaFeatures, | ||
jsx: true, | ||
}, | ||
}, | ||
settings: { | ||
...baseConfig.settings, | ||
'import/resolver': { | ||
...baseConfig.settings['import/resolver'], | ||
node: { | ||
extensions: [ | ||
...baseConfig.settings['import/resolver'].node.extensions, | ||
'.tsx', | ||
], | ||
}, | ||
}, | ||
'import/extensions': [...baseConfig.settings['import/extensions'], '.tsx'], | ||
react: { | ||
pragma: 'React', | ||
version: '16.0', | ||
}, | ||
}, | ||
rules: { | ||
...baseConfig.rules, | ||
'react/button-has-type': [ | ||
'error', | ||
{ | ||
button: true, | ||
submit: true, | ||
reset: false, | ||
}, | ||
], | ||
'react/default-props-match-prop-types': [ | ||
'error', | ||
{ allowRequiredDefaults: false }, | ||
], | ||
'react/destructuring-assignment': ['error', 'always'], | ||
'react/forbid-prop-types': [ | ||
'error', | ||
{ | ||
forbid: ['any', 'array', 'object'], | ||
checkContextTypes: true, | ||
checkChildContextTypes: true, | ||
}, | ||
], | ||
'react/no-access-state-in-setstate': 'error', | ||
'react/no-array-index-key': 'error', | ||
'react/no-children-prop': 'error', | ||
'react/no-danger': 'error', | ||
'react/no-danger-with-children': 'error', | ||
'react/no-deprecated': 'error', | ||
'react/no-did-update-set-state': 'error', | ||
'react/no-direct-mutation-state': 'error', | ||
'react/no-find-dom-node': 'error', | ||
'react/no-is-mounted': 'error', | ||
'react/no-multi-comp': ['error', { ignoreStateless: true }], | ||
'react/no-redundant-should-component-update': 'error', | ||
'react/no-render-return-value': 'error', | ||
'react/no-typos': 'error', | ||
'react/no-string-refs': 'error', | ||
'react/no-this-in-sfc': 'error', | ||
'react/no-unescaped-entities': 'error', | ||
'react/no-unknown-property': 'error', | ||
'react/no-unsafe': 'error', | ||
'react/no-unused-prop-types': [ | ||
'error', | ||
{ | ||
skipShapeProps: true, | ||
}, | ||
], | ||
'react/no-unused-state': 'error', | ||
'react/no-will-update-set-state': 'error', | ||
'react/prefer-es6-class': 'error', | ||
'react/prefer-stateless-function': [ | ||
'error', | ||
{ ignorePureComponents: true }, | ||
], | ||
'react/react-in-jsx-scope': 'error', | ||
'react/require-render-return': 'error', | ||
'react/style-prop-object': 'error', | ||
'react/void-dom-elements-no-children': 'error', | ||
'react/jsx-boolean-value': 'error', | ||
'react/jsx-filename-extension': ['error', { extensions: ['.js', '.tsx'] }], | ||
'react/jsx-handler-names': 'error', | ||
'react/jsx-key': 'error', | ||
'react/jsx-no-bind': [ | ||
'error', | ||
{ | ||
ignoreRefs: true, | ||
allowFunctions: false, | ||
allowBind: false, | ||
ignoreDOMComponents: true, | ||
}, | ||
], | ||
'react/jsx-no-comment-textnodes': 'error', | ||
'react/jsx-no-duplicate-props': ['error', { ignoreCase: true }], | ||
'react/jsx-no-target-blank': 'error', | ||
'react/jsx-no-undef': 'error', | ||
'react/jsx-curly-brace-presence': [ | ||
'error', | ||
{ props: 'never', children: 'never' }, | ||
], | ||
'react/jsx-pascal-case': [ | ||
'error', | ||
{ | ||
allowAllCaps: true, | ||
}, | ||
], | ||
'react/jsx-uses-react': 'error', | ||
'react/jsx-uses-vars': 'error', | ||
|
||
'jsx-a11y/accessible-emoji': 'error', | ||
'jsx-a11y/alt-text': 'error', | ||
'jsx-a11y/anchor-has-content': 'error', | ||
'jsx-a11y/anchor-is-valid': [ | ||
'error', | ||
{ | ||
components: ['Link'], | ||
specialLink: ['to'], | ||
}, | ||
], | ||
'jsx-a11y/aria-activedescendant-has-tabindex': 'error', | ||
'jsx-a11y/aria-props': 'error', | ||
'jsx-a11y/aria-proptypes': 'error', | ||
'jsx-a11y/aria-role': ['error', { ignoreNonDom: false }], | ||
'jsx-a11y/aria-unsupported-elements': 'error', | ||
'jsx-a11y/click-events-have-key-events': 'error', | ||
'jsx-a11y/heading-has-content': 'error', | ||
'jsx-a11y/html-has-lang': 'error', | ||
'jsx-a11y/iframe-has-title': 'error', | ||
'jsx-a11y/img-redundant-alt': 'error', | ||
'jsx-a11y/interactive-supports-focus': 'error', | ||
'jsx-a11y/lang': 'error', | ||
'jsx-a11y/media-has-caption': 'error', | ||
'jsx-a11y/mouse-events-have-key-events': 'error', | ||
'jsx-a11y/no-access-key': 'error', | ||
'jsx-a11y/no-autofocus': ['error', { ignoreNonDOM: true }], | ||
'jsx-a11y/no-distracting-elements': 'error', | ||
'jsx-a11y/no-interactive-element-to-noninteractive-role': [ | ||
'error', | ||
{ | ||
tr: ['none', 'presentation'], | ||
}, | ||
], | ||
'jsx-a11y/no-noninteractive-element-interactions': [ | ||
'error', | ||
{ | ||
handlers: [ | ||
'onClick', | ||
'onMouseDown', | ||
'onMouseUp', | ||
'onKeyPress', | ||
'onKeyDown', | ||
'onKeyUp', | ||
], | ||
}, | ||
], | ||
'jsx-a11y/no-noninteractive-element-to-interactive-role': [ | ||
'error', | ||
{ | ||
ul: [ | ||
'listbox', | ||
'menu', | ||
'menubar', | ||
'radiogroup', | ||
'tablist', | ||
'tree', | ||
'treegrid', | ||
], | ||
ol: [ | ||
'listbox', | ||
'menu', | ||
'menubar', | ||
'radiogroup', | ||
'tablist', | ||
'tree', | ||
'treegrid', | ||
], | ||
li: ['menuitem', 'option', 'row', 'tab', 'treeitem'], | ||
table: ['grid'], | ||
td: ['gridcell'], | ||
}, | ||
], | ||
'jsx-a11y/no-noninteractive-tabindex': [ | ||
'error', | ||
{ | ||
tags: [], | ||
roles: ['tabpanel'], | ||
}, | ||
], | ||
'jsx-a11y/no-redundant-roles': 'error', | ||
'jsx-a11y/no-static-element-interactions': [ | ||
'error', | ||
{ | ||
handlers: [ | ||
'onClick', | ||
'onMouseDown', | ||
'onMouseUp', | ||
'onKeyPress', | ||
'onKeyDown', | ||
'onKeyUp', | ||
], | ||
}, | ||
], | ||
'jsx-a11y/role-has-required-aria-props': 'error', | ||
'jsx-a11y/role-supports-aria-props': 'error', | ||
'jsx-a11y/scope': 'error', | ||
'jsx-a11y/tabindex-no-positive': 'error', | ||
'no-multi-str': 'off', // keep this until https://github.com/eslint/typescript-eslint-parser/issues/503 is closed | ||
}, | ||
} | ||
|
||
module.exports = config |
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
Oops, something went wrong.