Skip to content

Commit

Permalink
feat(eslint-config): add js rules
Browse files Browse the repository at this point in the history
* no-else-return
* no-debugger
* no-unused-expressions
* import/no-absolute-path
* import/no-extraneous-dependencies
* import/no-mutable-exports
* no-secrets/no-secrets
  • Loading branch information
andrepolischuk committed Aug 13, 2024
1 parent 21ad603 commit 8d7fb50
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 6 deletions.
20 changes: 17 additions & 3 deletions packages/eslint-config/js.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module.exports = {
'plugin:security/recommended-legacy',
'prettier'
],
plugins: ['promise', 'unicorn', 'todo-with-label'],
plugins: ['promise', 'unicorn', 'todo-with-label', 'no-secrets'],
rules: {
'no-multiple-empty-lines': ['error', {max: 1}],
'no-empty': ['error', {allowEmptyCatch: true}],
Expand Down Expand Up @@ -63,7 +63,9 @@ module.exports = {
'no-prototype-builtins': 'off',
'no-global-assign': 'error',
'no-extend-native': 'error',
'no-else-return': 'error',
'no-alert': 'error',
'no-debugger': 'error',
'no-console': ['error', {allow: ['warn', 'error']}],
'no-unsafe-optional-chaining': [
'error',
Expand All @@ -73,7 +75,14 @@ module.exports = {
'error',
{argsIgnorePattern: '^_', varsIgnorePattern: '^_'}
],
'no-unused-expressions': ['error', {enforceForJSX: true}],
'no-unused-expressions': [
'error',
{
enforceForJSX: true,
allowShortCircuit: false,
allowTernary: false
}
],
'no-sequences': ['error', {allowInParentheses: false}],
'no-implicit-coercion': [
'error',
Expand Down Expand Up @@ -137,6 +146,9 @@ module.exports = {
],
'import/no-cycle': 'error',
'import/no-useless-path-segments': 'error',
'import/no-absolute-path': 'error',
'import/no-extraneous-dependencies': 'error',
'import/no-mutable-exports': 'error',
'import/no-default-export': 'error',
'import/no-duplicates': 'error',
'import/no-self-import': 'error',
Expand Down Expand Up @@ -223,6 +235,7 @@ module.exports = {
'security/detect-pseudoRandomBytes': 'error',
'security/detect-unsafe-regex': 'off',
'security/detect-bidi-characters': 'error',
'no-secrets/no-secrets': 'error',
'todo-with-label/has-valid-pattern': [
'error',
{
Expand Down Expand Up @@ -250,7 +263,8 @@ module.exports = {
'max-classes-per-file': 'off',
'max-nested-callbacks': 'off',
'sonarjs/no-duplicate-string': 'off',
'sonarjs/no-identical-functions': 'off'
'sonarjs/no-identical-functions': 'off',
'no-secrets/no-secrets': 'off'
}
}
],
Expand Down
1 change: 1 addition & 0 deletions packages/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"eslint-import-resolver-webpack": "^0.13.8",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsx-a11y": "^6.8.0",
"eslint-plugin-no-secrets": "^1.0.2",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-react": "^7.28.0",
"eslint-plugin-react-hooks": "^4.3.0",
Expand Down
36 changes: 33 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2765,6 +2765,11 @@ eslint-plugin-jsx-a11y@^6.8.0:
object.entries "^1.1.7"
object.fromentries "^2.0.7"

eslint-plugin-no-secrets@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/eslint-plugin-no-secrets/-/eslint-plugin-no-secrets-1.0.2.tgz#a3860d547ee3be96adc002ec72ac1c6c875278aa"
integrity sha512-lXjGcPS6ZMxAouYWsuX5NGsLlOWQ5c+YFHHZFECzRCZIssYQgWVPINgZqAU7caquB32MoEAL+dXRQNDBX0fgwQ==

eslint-plugin-promise@^6.1.1:
version "6.1.1"
resolved "https://registry.yarnpkg.com/eslint-plugin-promise/-/eslint-plugin-promise-6.1.1.tgz#269a3e2772f62875661220631bd4dafcb4083816"
Expand Down Expand Up @@ -6239,7 +6244,16 @@ [email protected]:
resolved "https://registry.yarnpkg.com/string-argv/-/string-argv-0.3.2.tgz#2b6d0ef24b656274d957d54e0a4bbf6153dc02b6"
integrity sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q==

"string-width-cjs@npm:string-width@^4.2.0", "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
"string-width-cjs@npm:string-width@^4.2.0":
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
dependencies:
emoji-regex "^8.0.0"
is-fullwidth-code-point "^3.0.0"
strip-ansi "^6.0.1"

"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
Expand Down Expand Up @@ -6313,7 +6327,14 @@ string_decoder@~1.1.1:
dependencies:
safe-buffer "~5.1.0"

"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
dependencies:
ansi-regex "^5.0.1"

strip-ansi@^6.0.0, strip-ansi@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
Expand Down Expand Up @@ -6907,7 +6928,7 @@ wordwrap@^1.0.0:
resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb"
integrity sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==

"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
Expand All @@ -6925,6 +6946,15 @@ wrap-ansi@^6.0.1:
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
dependencies:
ansi-styles "^4.0.0"
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^8.0.1, wrap-ansi@^8.1.0:
version "8.1.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"
Expand Down

0 comments on commit 8d7fb50

Please sign in to comment.