Skip to content

Commit

Permalink
Add eslint config from create-react-app, include react-dom inside plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
zackify committed Apr 24, 2018
1 parent 6110daa commit 62edf10
Show file tree
Hide file tree
Showing 7 changed files with 1,075 additions and 14 deletions.
14 changes: 10 additions & 4 deletions config/base.webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,20 @@ module.exports = ({
exclude: /node_modules/,
use: [
{
loader: require.resolve('./loader'),
loader: require.resolve('babel-loader'),
options: babelOptions,
},
{
loader: require.resolve('eslint-loader'),
options: {
pluginFolderName,
configFile: require.resolve('./eslint.js'),
},
},
{
loader: require.resolve('babel-loader'),
options: babelOptions,
loader: require.resolve('./loader'),
options: {
pluginFolderName,
},
},
],
},
Expand Down
12 changes: 12 additions & 0 deletions config/eslint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
extends: require.resolve('eslint-config-react-app'),
rules: {
'react/react-in-jsx-scope': 0,
'jsx-a11y/href-no-hash': 0,
'react/jsx-no-undef': [true, { allowGlobals: true }],
},
globals: {
wp: true,
React: true,
},
};
2 changes: 1 addition & 1 deletion config/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module.exports = function(source) {
${source}
Block.edit = props => wp.element.createElement(Import, {...props, load: () => import('./edit')});
Block.edit = props => <Import {...props} load={() => import('./edit')} />;
if(!Block.save) Block.save = () => '';
Expand Down
Loading

0 comments on commit 62edf10

Please sign in to comment.