Skip to content
This repository has been archived by the owner on Sep 25, 2023. It is now read-only.

Commit

Permalink
add eslint-plugin-unicorn
Browse files Browse the repository at this point in the history
BREAKING CHANGE: added eslint rules
  • Loading branch information
spudly committed Oct 2, 2021
1 parent f6c2de8 commit 606eb2b
Show file tree
Hide file tree
Showing 4 changed files with 1,342 additions and 308 deletions.
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run lint -- --fix
npx --no-install lint-staged
npx --no-install pretty-quick --staged
96 changes: 95 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable unicorn/prefer-module */
/* eslint-disable @typescript-eslint/no-var-requires */
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
const restrictedGlobals = require("confusing-browser-globals");
Expand Down Expand Up @@ -26,6 +27,7 @@ module.exports = {
"react-hooks",
"@typescript-eslint",
"sonarjs",
"unicorn",
],
root: true,
settings: {
Expand Down Expand Up @@ -517,7 +519,7 @@ module.exports = {
"no-redeclare": ["warn"],
"no-regex-spaces": "warn",
"no-restricted-exports": "off",
"no-restricted-globals": ["error"].concat(restrictedGlobals),
"no-restricted-globals": ["error", ...restrictedGlobals],
"no-restricted-imports": "off",
"no-restricted-properties": [
"error",
Expand Down Expand Up @@ -807,6 +809,98 @@ module.exports = {
"template-curly-spacing": "off",
"template-tag-spacing": "off",
"unicode-bom": ["warn", "never"],

"unicorn/better-regex": "warn",
"unicorn/catch-error-name": "warn",
"unicorn/consistent-destructuring": "warn",
"unicorn/consistent-function-scoping": "warn",
"unicorn/custom-error-definition": "warn",
"unicorn/empty-brace-spaces": "off",
"unicorn/error-message": "error",
"unicorn/escape-case": "warn",
"unicorn/expiring-todo-comments": "warn",
"unicorn/explicit-length-check": "warn",
"unicorn/filename-case": "error",
"unicorn/import-index": "warn",
"unicorn/import-style": "warn",
"unicorn/new-for-builtins": "warn",
"unicorn/no-abusive-eslint-disable": "warn",
"unicorn/no-array-callback-reference": "off",
"unicorn/no-array-for-each": "off",
"unicorn/no-array-method-this-argument": "warn",
"unicorn/no-array-push-push": "warn",
"unicorn/no-array-reduce": "off",
"unicorn/no-console-spaces": "warn",
"unicorn/no-document-cookie": "warn",
"unicorn/no-for-loop": "warn",
"unicorn/no-hex-escape": "warn",
"unicorn/no-instanceof-array": "warn",
"unicorn/no-invalid-remove-event-listener": "warn",
"unicorn/no-keyword-prefix": "off",
"unicorn/no-lonely-if": "warn",
"unicorn/no-nested-ternary": "off",
"unicorn/no-new-array": "warn",
"unicorn/no-new-buffer": "warn",
"unicorn/no-null": "off",
"unicorn/no-object-as-default-parameter": "warn",
"unicorn/no-process-exit": "error",
"unicorn/no-static-only-class": "warn",
"unicorn/no-this-assignment": "warn",
"unicorn/no-unreadable-array-destructuring": "warn",
"unicorn/no-unsafe-regex": "off",
"unicorn/no-unused-properties": "off",
"unicorn/no-useless-fallback-in-spread": "warn",
"unicorn/no-useless-length-check": "warn",
"unicorn/no-useless-spread": "warn",
"unicorn/no-useless-undefined": "warn",
"unicorn/no-zero-fractions": "warn",
"unicorn/number-literal-case": "warn",
"unicorn/numeric-separators-style": "warn",
"unicorn/prefer-add-event-listener": "warn",
"unicorn/prefer-array-find": "warn",
"unicorn/prefer-array-flat": "warn",
"unicorn/prefer-array-flat-map": "warn",
"unicorn/prefer-array-index-of": "warn",
"unicorn/prefer-array-some": "warn",
"unicorn/prefer-at": "warn",
"unicorn/prefer-date-now": "warn",
"unicorn/prefer-default-parameters": "warn",
"unicorn/prefer-dom-node-append": "warn",
"unicorn/prefer-dom-node-dataset": "warn",
"unicorn/prefer-dom-node-remove": "warn",
"unicorn/prefer-dom-node-text-content": "warn",
"unicorn/prefer-includes": "warn",
"unicorn/prefer-keyboard-event-key": "warn",
"unicorn/prefer-math-trunc": "warn",
"unicorn/prefer-modern-dom-apis": "warn",
"unicorn/prefer-module": "warn",
"unicorn/prefer-negative-index": "warn",
"unicorn/prefer-node-protocol": "warn",
"unicorn/prefer-number-properties": "warn",
"unicorn/prefer-object-from-entries": "warn",
"unicorn/prefer-object-has-own": "warn",
"unicorn/prefer-optional-catch-binding": "warn",
"unicorn/prefer-prototype-methods": "warn",
"unicorn/prefer-query-selector": "warn",
"unicorn/prefer-reflect-apply": "warn",
"unicorn/prefer-regexp-test": "warn",
"unicorn/prefer-set-has": "warn",
"unicorn/prefer-spread": "warn",
"unicorn/prefer-string-replace-all": "warn",
"unicorn/prefer-string-slice": "warn",
"unicorn/prefer-string-starts-ends-with": "warn",
"unicorn/prefer-string-trim-start-end": "warn",
"unicorn/prefer-switch": "warn",
"unicorn/prefer-ternary": "warn",
"unicorn/prefer-top-level-await": "off",
"unicorn/prefer-type-error": "warn",
"unicorn/prevent-abbreviations": "warn",
"unicorn/require-array-join-separator": "error",
"unicorn/require-number-to-fixed-digits-argument": "error",
"unicorn/require-post-message-target-origin": "warn",
"unicorn/string-content": "off",
"unicorn/throw-new-error": "warn",

"use-isnan": "warn",
"valid-typeof": "error",
"vars-on-top": "off",
Expand Down
Loading

0 comments on commit 606eb2b

Please sign in to comment.