Skip to content

Commit

Permalink
Merge pull request #262 from redwoodjs/pp-fix-warnings-in-linter
Browse files Browse the repository at this point in the history
Fix ESLint warnings
  • Loading branch information
peterp authored Mar 15, 2020
2 parents 2f8573e + d2d8314 commit 12fd80c
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 30 deletions.
8 changes: 4 additions & 4 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ module.exports = {
],
},
],
// Only build test files when testing
// Do not build tests or mocks in production.
ignore:
process.env.NODE_ENV === 'test'
? []
: [/\.test\.(js|ts)/, '**/__tests__', '**/__mocks__'],
process.env.NODE_ENV === 'production'
? [/\.test\.(js|ts)/, '**/__tests__', '**/__mocks__']
: [],
}
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@
"eslintConfig": {
"extends": "@redwoodjs/eslint-config"
},
"eslintIgnore": ["dist", "packages/api/importAll.macro.js"],
"scripts": {
"build": "lerna run build",
"build": "NODE_ENV=production lerna run build",
"test": "lerna run test --stream -- --colors",
"lint": "yarn eslint 'packages/*/src/**/*.js'",
"lint:fix": "yarn eslint --fix 'packages/*/src/**/*.js'"
"lint": "yarn eslint './packages/'",
"lint:fix": "yarn eslint --fix './packages/'"
}
}
2 changes: 1 addition & 1 deletion packages/api/__mocks__/@prisma/client.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const PrismaClient = class MockPrismaClient { }
export const PrismaClient = class MockPrismaClient {}
2 changes: 1 addition & 1 deletion packages/cli/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
testMatch: [ "**/__tests__/**/*.[jt]s?(x)", "**/*.test.[jt]s?(x)" ]
testMatch: ['**/__tests__/**/*.[jt]s?(x)', '**/*.test.[jt]s?(x)'],
}
14 changes: 5 additions & 9 deletions packages/cli/src/commands/lint.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,9 @@ export const builder = {
}

export const handler = ({ fix }) => {
execa(
'yarn eslint',
[fix && '--fix', 'web/src/**/*.js', 'api/src/**/*.js'].filter(Boolean),
{
cwd: getPaths().base,
shell: true,
stdio: 'inherit',
}
)
execa('yarn eslint', [fix && '--fix', 'web/src', 'api/src'].filter(Boolean), {
cwd: getPaths().base,
shell: true,
stdio: 'inherit',
})
}
9 changes: 5 additions & 4 deletions packages/eslint-config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module.exports = {
'react-hooks',
'@redwoodjs/redwood',
],
ignorePatterns: ['node_modules'],
ignorePatterns: ['node_modules', 'dist'],
extends: [
'eslint:recommended',
'plugin:react/recommended',
Expand All @@ -45,16 +45,17 @@ module.exports = {
},
},
{
files: ['api/src/**/*.js'],
files: ['api/src/**'],
globals: {
db: 'readonly',
context: 'readonly',
},
},
],
settings: {
// This is used to support our `import/order` configuration.
'import/resolver': {
'babel-module': {},
'eslint-import-resolver-babel-module': {},
},
react: {
version: 'detect',
Expand Down Expand Up @@ -106,7 +107,7 @@ module.exports = {
],
// React rules
'react/prop-types': [
'error',
'warn',
{
skipUndeclared: true,
ignore: ['style', 'children', 'className', 'theme'],
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"eslint-plugin-import": "^2.20.1",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-prettier": "^3.1.2",
"eslint-plugin-react": "^7.18.3",
"eslint-plugin-react": "^7.19.0",
"eslint-plugin-react-hooks": "^2.5.0",
"prettier": "^1.19.1"
},
Expand Down
23 changes: 16 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1066,7 +1066,7 @@
pirates "^4.0.0"
source-map-support "^0.5.16"

"@babel/runtime-corejs3@^7.7.4":
"@babel/runtime-corejs3@^7.7.4", "@babel/runtime-corejs3@^7.8.3":
version "7.8.7"
resolved "https://registry.yarnpkg.com/@babel/runtime-corejs3/-/runtime-corejs3-7.8.7.tgz#8209d9dff2f33aa2616cb319c83fe159ffb07b8c"
integrity sha512-sc7A+H4I8kTd7S61dgB9RomXu/C+F4IrRr4Ytze4dnfx7AXEpCrejSNpjx7vq6y/Bak9S6Kbk65a/WgMLtg43Q==
Expand Down Expand Up @@ -6142,10 +6142,10 @@ eslint-plugin-react-hooks@^2.5.0:
resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-2.5.0.tgz#c50ab7ca5945ce6d1cf8248d9e185c80b54171b6"
integrity sha512-bzvdX47Jx847bgAYf0FPX3u1oxU+mKU8tqrpj4UX9A96SbAmj/HVEefEy6rJUog5u8QIlOPTKZcBpGn5kkKfAQ==

eslint-plugin-react@^7.18.3:
version "7.18.3"
resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.18.3.tgz#8be671b7f6be095098e79d27ac32f9580f599bc8"
integrity sha512-Bt56LNHAQCoou88s8ViKRjMB2+36XRejCQ1VoLj716KI1MoE99HpTVvIThJ0rvFmG4E4Gsq+UgToEjn+j044Bg==
eslint-plugin-react@^7.19.0:
version "7.19.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.19.0.tgz#6d08f9673628aa69c5559d33489e855d83551666"
integrity sha512-SPT8j72CGuAP+JFbT0sJHOB80TX/pu44gQ4vXH/cq+hQTiY2PuZ6IHkqXJV6x1b28GDdo1lbInjKUrrdUf0LOQ==
dependencies:
array-includes "^3.1.1"
doctrine "^2.1.0"
Expand All @@ -6155,8 +6155,10 @@ eslint-plugin-react@^7.18.3:
object.fromentries "^2.0.2"
object.values "^1.1.1"
prop-types "^15.7.2"
resolve "^1.14.2"
resolve "^1.15.1"
semver "^6.3.0"
string.prototype.matchall "^4.0.2"
xregexp "^4.3.0"

eslint-rule-composer@^0.3.0:
version "0.3.0"
Expand Down Expand Up @@ -11662,7 +11664,7 @@ [email protected]:
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b"
integrity sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=

resolve@^1.10.0, resolve@^1.11.0, resolve@^1.11.1, resolve@^1.12.0, resolve@^1.13.1, resolve@^1.14.2, resolve@^1.3.2, resolve@^1.8.1, resolve@^1.9.0:
resolve@^1.10.0, resolve@^1.11.0, resolve@^1.11.1, resolve@^1.12.0, resolve@^1.13.1, resolve@^1.15.1, resolve@^1.3.2, resolve@^1.8.1, resolve@^1.9.0:
version "1.15.1"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.15.1.tgz#27bdcdeffeaf2d6244b95bb0f9f4b4653451f3e8"
integrity sha512-84oo6ZTtoTUpjgNEr5SJyzQhzL72gaRodsSfyxC/AXRvwu0Yse9H8eF9IpGo7b8YetZhlI6v7ZQ6bKBFV/6S7w==
Expand Down Expand Up @@ -13872,6 +13874,13 @@ xmlchars@^2.1.1:
resolved "https://registry.yarnpkg.com/xmlchars/-/xmlchars-2.2.0.tgz#060fe1bcb7f9c76fe2a17db86a9bc3ab894210cb"
integrity sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==

xregexp@^4.3.0:
version "4.3.0"
resolved "https://registry.yarnpkg.com/xregexp/-/xregexp-4.3.0.tgz#7e92e73d9174a99a59743f67a4ce879a04b5ae50"
integrity sha512-7jXDIFXh5yJ/orPn4SXjuVrWWoi4Cr8jfV1eHv9CixKSbU+jY4mxfrBwAuDvupPNKpMUY+FeIqsVw/JLT9+B8g==
dependencies:
"@babel/runtime-corejs3" "^7.8.3"

xtend@^4.0.0, xtend@~4.0.1:
version "4.0.2"
resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54"
Expand Down

0 comments on commit 12fd80c

Please sign in to comment.