Skip to content

Commit fe5f598

Browse files
committed
feat(react-scripts/webpack): do not lint *.bs.js files, generated by BuckleScript
1 parent 7ecbc02 commit fe5f598

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

packages/react-scripts/config/webpack.config.dev.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,13 @@ module.exports = {
124124
// First, run the linter.
125125
// It's important to do this before Babel processes the JS.
126126
{
127-
test: /\.(js|jsx|mjs)$/,
127+
test: function testForJsFilesExcludingBsFiles(fileName) {
128+
// Do not lint `*.bs.js` files, generated by BuckleScript.
129+
if (fileName.endsWith('.bs.js')) {
130+
return false;
131+
}
132+
return /\.(js|jsx|mjs)$/.test(fileName);
133+
},
128134
enforce: 'pre',
129135
use: [
130136
{

packages/react-scripts/config/webpack.config.prod.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,13 @@ module.exports = {
130130
// First, run the linter.
131131
// It's important to do this before Babel processes the JS.
132132
{
133-
test: /\.(js|jsx|mjs)$/,
133+
test: function testForJsFilesExcludingBsFiles(fileName) {
134+
// Do not lint `*.bs.js` files, generated by BuckleScript.
135+
if (fileName.endsWith('.bs.js')) {
136+
return false;
137+
}
138+
return /\.(js|jsx|mjs)$/.test(fileName);
139+
},
134140
enforce: 'pre',
135141
use: [
136142
{

0 commit comments

Comments
 (0)