Add an eslint rule to avoid full lodash import

This commit is contained in:
Marshall Polaris 2022-05-22 01:21:24 -07:00
parent 93108ae3ec
commit 673ef133c6
5 changed files with 16 additions and 3 deletions

View File

@ -1,4 +1,5 @@
module.exports = {
plugins: ['lodash'],
extends: ['eslint:recommended'],
env: {
browser: true,
@ -14,5 +15,6 @@ module.exports = {
rules: {
'no-unused-vars': 'off',
'no-constant-condition': ['error', { checkLoops: false }],
'lodash/import-scope': [2, 'member'],
},
}

View File

@ -1,4 +1,5 @@
module.exports = {
plugins: ['lodash'],
extends: ['eslint:recommended'],
ignorePatterns: ['lib'],
env: {
@ -17,5 +18,6 @@ module.exports = {
rules: {
'no-unused-vars': 'off',
'no-constant-condition': ['error', { checkLoops: false }],
'lodash/import-scope': [2, 'member'],
},
}

View File

@ -9,10 +9,11 @@
"scripts": {},
"dependencies": {},
"devDependencies": {
"typescript": "4.6.4",
"@typescript-eslint/eslint-plugin": "5.25.0",
"@typescript-eslint/parser": "5.25.0",
"eslint": "8.15.0",
"prettier": "2.5.0"
"eslint-plugin-lodash": "^7.4.0",
"prettier": "2.5.0",
"typescript": "4.6.4"
}
}

View File

@ -1,9 +1,10 @@
module.exports = {
parser: '@typescript-eslint/parser',
plugins: ['lodash'],
extends: ['plugin:react-hooks/recommended', 'plugin:@next/next/recommended'],
rules: {
// Add or disable rules here.
'@next/next/no-img-element': 'off',
'@next/next/no-typos': 'off',
'lodash/import-scope': [2, 'member'],
},
}

View File

@ -2394,6 +2394,13 @@ eslint-plugin-jsx-a11y@^6.5.1:
language-tags "^1.0.5"
minimatch "^3.0.4"
eslint-plugin-lodash@^7.4.0:
version "7.4.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-lodash/-/eslint-plugin-lodash-7.4.0.tgz#14a761547f126c92ff56789662a20a44f8bb6290"
integrity sha512-Tl83UwVXqe1OVeBRKUeWcfg6/pCW1GTRObbdnbEJgYwjxp5Q92MEWQaH9+dmzbRt6kvYU1Mp893E79nJiCSM8A==
dependencies:
lodash "^4.17.21"
eslint-plugin-react-hooks@^4.5.0:
version "4.5.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.5.0.tgz#5f762dfedf8b2cf431c689f533c9d3fa5dcf25ad"