diff --git a/packages/react-scripts/config/webpack.config.dev.js b/packages/react-scripts/config/webpack.config.dev.js index 9f3131b0660..936e859854f 100644 --- a/packages/react-scripts/config/webpack.config.dev.js +++ b/packages/react-scripts/config/webpack.config.dev.js @@ -124,7 +124,13 @@ module.exports = { // First, run the linter. // It's important to do this before Babel processes the JS. { - test: /\.(js|jsx|mjs)$/, + test: function testForJsFilesExcludingBsFiles(fileName) { + // Do not lint `*.bs.js` files, generated by BuckleScript. + if (fileName.endsWith('.bs.js')) { + return false; + } + return /\.(js|jsx|mjs)$/.test(fileName); + }, enforce: 'pre', use: [ { diff --git a/packages/react-scripts/config/webpack.config.prod.js b/packages/react-scripts/config/webpack.config.prod.js index 3b2a2068db2..c115140cf3a 100644 --- a/packages/react-scripts/config/webpack.config.prod.js +++ b/packages/react-scripts/config/webpack.config.prod.js @@ -130,7 +130,13 @@ module.exports = { // First, run the linter. // It's important to do this before Babel processes the JS. { - test: /\.(js|jsx|mjs)$/, + test: function testForJsFilesExcludingBsFiles(fileName) { + // Do not lint `*.bs.js` files, generated by BuckleScript. + if (fileName.endsWith('.bs.js')) { + return false; + } + return /\.(js|jsx|mjs)$/.test(fileName); + }, enforce: 'pre', use: [ {