Skip to content

Commit

Permalink
feat: upgrade eslint-plugin-unicorn to v31
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob McGuinness committed May 3, 2021
1 parent 0ec8ae9 commit 042a31d
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 45 deletions.
7 changes: 4 additions & 3 deletions base.js
Expand Up @@ -68,8 +68,11 @@ module.exports = {
'unicorn/no-null': 0,
'unicorn/number-literal-case': 0,
'unicorn/prefer-includes': 'off',
'unicorn/prefer-node-remove': 'off',
'unicorn/prefer-dom-node-remove': 'off',
'unicorn/prevent-abbreviations': 'off',
'unicorn/prefer-module': 0,
'unicorn/prefer-dom-node-append': 0,
'unicorn/no-array-reduce': 0,
'import/no-extraneous-dependencies': 0,
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }],
'no-underscore-dangle': 0,
Expand All @@ -81,7 +84,5 @@ module.exports = {
array: false,
},
],
'unicorn/prefer-node-append': 0,
'unicorn/no-reduce': 0,
},
};
21 changes: 19 additions & 2 deletions package.json
Expand Up @@ -49,7 +49,7 @@
"eslint-plugin-promise": "^5.1.0",
"eslint-plugin-react": "^7.21.5",
"eslint-plugin-react-hooks": "^4.2.0",
"eslint-plugin-unicorn": "^24.0.0"
"eslint-plugin-unicorn": "^31.0.0"
},
"peerDependencies": {
"@typescript-eslint/eslint-plugin": "^4.3.0",
Expand Down Expand Up @@ -85,7 +85,24 @@
"commitlint": {
"extends": [
"@commitlint/config-conventional"
]
],
"rules": {
"header-max-length": [
0,
"always",
100
],
"body-max-line-length": [
0,
"always",
500
],
"footer-max-line-length": [
0,
"always",
500
]
}
},
"husky": {
"hooks": {
Expand Down
6 changes: 3 additions & 3 deletions tests/base.js
Expand Up @@ -53,10 +53,10 @@ const fn = () => {
// unicorn/prefer-includes
[].indexOf('foo') !== -1;
// unicorn/prefer-node-remove
// unicorn/prefer-dom-node-remove
this.parentNode.removeChild(this)
// unicorn/prefer-node-append
// unicorn/prefer-dom-node-append
const anchor = document.createElement('a');
document.body.appendChild(anchor);
Expand All @@ -73,7 +73,7 @@ function readFile(filename, callback) {
var targetLength = 1;
targetLength >>= 0;
// unicorn/no-reduce
// unicorn/no-array-reduce
var array = [1, 2, 3]
var result = array.reduce((acc, current) => acc + current)
`;
6 changes: 3 additions & 3 deletions tests/test.js
Expand Up @@ -38,12 +38,12 @@ describe('rules', () => {
expect(find(errors, { ruleId: 'no-underscore-dangle' })).toBeUndefined();
expect(find(errors, { ruleId: 'promise/avoid-new' })).toBeUndefined();
expect(find(errors, { ruleId: 'unicorn/prefer-includes' })).toBeUndefined();
expect(find(errors, { ruleId: 'unicorn/prefer-node-remove' })).toBeUndefined();
expect(find(errors, { ruleId: 'unicorn/prefer-node-append' })).toBeUndefined();
expect(find(errors, { ruleId: 'unicorn/prefer-dom-node-remove' })).toBeUndefined();
expect(find(errors, { ruleId: 'unicorn/prefer-dom-node-append' })).toBeUndefined();
expect(find(errors, { ruleId: 'unicorn/prefer-math-trunc' })).toBeUndefined();
expect(find(errors, { ruleId: 'no-restricted-syntax' })).toBeUndefined();
expect(find(errors, { ruleId: 'global-require' })).toBeUndefined();
expect(find(errors, { ruleId: 'unicorn/no-reduce' })).toBeUndefined();
expect(find(errors, { ruleId: 'unicorn/no-array-reduce' })).toBeUndefined();
});

test('react', () => {
Expand Down
68 changes: 34 additions & 34 deletions yarn.lock
Expand Up @@ -1314,6 +1314,11 @@ buffer-from@^1.0.0:
resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef"
integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==

builtin-modules@^3.0.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-3.2.0.tgz#45d5db99e7ee5e6bc4f362e008bf917ab5049887"
integrity sha512-lGzLKcioL90C7wMczpkY0n/oART3MbBa8R9OFGE1rJxoVI86u4WAGfEk8Wjv10eKSyTHVGkSo3bvBylCEtk7LA==

cache-base@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/cache-base/-/cache-base-1.0.1.tgz#0a7f46416831c8b662ee36fe4e7c59d76f666ab2"
Expand Down Expand Up @@ -1418,6 +1423,11 @@ ci-info@^2.0.0:
resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-2.0.0.tgz#67a9e964be31a51e15e5010d58e6f12834002f46"
integrity sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==

ci-info@^3.1.1:
version "3.1.1"
resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.1.1.tgz#9a32fcefdf7bcdb6f0a7e1c0f8098ec57897b80a"
integrity sha512-kdRWLBIJwdsYJWYJFtAFFYxybguqeF91qpZaggjG5Nf8QKdizFG2hjqvaTXbxFIcYbSaD74KpAXv6BSm17DHEQ==

cjs-module-lexer@^0.6.0:
version "0.6.0"
resolved "https://registry.yarnpkg.com/cjs-module-lexer/-/cjs-module-lexer-0.6.0.tgz#4186fcca0eae175970aee870b9fe2d6cf8d5655f"
Expand Down Expand Up @@ -2122,14 +2132,6 @@ escodegen@^2.0.0:
optionalDependencies:
source-map "~0.6.1"

eslint-ast-utils@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/eslint-ast-utils/-/eslint-ast-utils-1.1.0.tgz#3d58ba557801cfb1c941d68131ee9f8c34bd1586"
integrity sha512-otzzTim2/1+lVrlH19EfQQJEhVJSu0zOb9ygb3iapN6UlyaDtyRq4b5U1FuW0v1lRa9Fp/GJyHkSwm6NqABgCA==
dependencies:
lodash.get "^4.4.2"
lodash.zip "^4.2.0"

eslint-config-airbnb-base@^14.2.1:
version "14.2.1"
resolved "https://registry.yarnpkg.com/eslint-config-airbnb-base/-/eslint-config-airbnb-base-14.2.1.tgz#8a2eb38455dc5a312550193b319cdaeef042cd1e"
Expand Down Expand Up @@ -2248,24 +2250,25 @@ eslint-plugin-react@^7.21.5:
resolve "^2.0.0-next.3"
string.prototype.matchall "^4.0.4"

eslint-plugin-unicorn@^24.0.0:
version "24.0.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-unicorn/-/eslint-plugin-unicorn-24.0.0.tgz#08017ccd7ac704777d459cff6e13a35f54cbcab1"
integrity sha512-NfLjIZas/ZUwc3S+pUtbTRqgCkODxPEkJBJ5ZR8wIu90BmX4jmXp10hoOZMScR2CR1NYTtrx0OX4BQvBnbzZzA==
eslint-plugin-unicorn@^31.0.0:
version "31.0.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-unicorn/-/eslint-plugin-unicorn-31.0.0.tgz#53eef3f5152ddaa531888f77a420313e30d9864a"
integrity sha512-HR3gI4ANtV8A+0FLAaxjBD/G5J3PWBo+7OswyGeK5nylGqtKLJVbnPksIkBgmVg+SFpxu5MnjaxQQI+9KjyVAg==
dependencies:
ci-info "^2.0.0"
ci-info "^3.1.1"
clean-regexp "^1.0.0"
eslint-ast-utils "^1.1.0"
eslint-template-visitor "^2.2.1"
eslint-template-visitor "^2.3.2"
eslint-utils "^2.1.0"
import-modules "^2.0.0"
lodash "^4.17.20"
eslint-visitor-keys "^2.0.0"
import-modules "^2.1.0"
is-builtin-module "^3.1.0"
lodash "^4.17.21"
pluralize "^8.0.0"
read-pkg-up "^7.0.1"
regexp-tree "^0.1.21"
regexp-tree "^0.1.23"
reserved-words "^0.1.2"
safe-regex "^2.1.1"
semver "^7.3.4"
semver "^7.3.5"

eslint-scope@^5.0.0, eslint-scope@^5.1.0, eslint-scope@^5.1.1:
version "5.1.1"
Expand All @@ -2275,7 +2278,7 @@ eslint-scope@^5.0.0, eslint-scope@^5.1.0, eslint-scope@^5.1.1:
esrecurse "^4.3.0"
estraverse "^4.1.1"

eslint-template-visitor@^2.2.1:
eslint-template-visitor@^2.3.2:
version "2.3.2"
resolved "https://registry.yarnpkg.com/eslint-template-visitor/-/eslint-template-visitor-2.3.2.tgz#b52f96ff311e773a345d79053ccc78275bbc463d"
integrity sha512-3ydhqFpuV7x1M9EK52BPNj6V0Kwu0KKkcIAfpUhwHbR8ocRln/oUHgfxQupY8O1h4Qv/POHDumb/BwwNfxbtnA==
Expand Down Expand Up @@ -3041,7 +3044,7 @@ import-local@^3.0.2:
pkg-dir "^4.2.0"
resolve-cwd "^3.0.0"

import-modules@^2.0.0:
import-modules@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/import-modules/-/import-modules-2.1.0.tgz#abe7df297cb6c1f19b57246eb8b8bd9664b6d8c2"
integrity sha512-8HEWcnkbGpovH9yInoisxaSoIg9Brbul+Ju3Kqe2UsYDUBJD/iQjSgEj0zPcTDPKfPp2fs5xlv1i+JSye/m1/A==
Expand Down Expand Up @@ -3131,6 +3134,13 @@ is-buffer@^1.1.5:
resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be"
integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==

is-builtin-module@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/is-builtin-module/-/is-builtin-module-3.1.0.tgz#6fdb24313b1c03b75f8b9711c0feb8c30b903b00"
integrity sha512-OV7JjAgOTfAFJmHZLvpSTb4qi0nIILDV1gWPYDnDJUTNFM5aGlRAhk4QcT8i7TuAleeEV5Fdkqn3t4mS+Q11fg==
dependencies:
builtin-modules "^3.0.0"

is-callable@^1.1.4, is-callable@^1.2.3:
version "1.2.3"
resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.3.tgz#8b1e0500b73a1d76c70487636f368e519de8db8e"
Expand Down Expand Up @@ -4110,11 +4120,6 @@ lodash.flatten@^4.4.0:
resolved "https://registry.yarnpkg.com/lodash.flatten/-/lodash.flatten-4.4.0.tgz#f31c22225a9632d2bbf8e4addbef240aa765a61f"
integrity sha1-8xwiIlqWMtK7+OSt2+8kCqdlph8=

lodash.get@^4.4.2:
version "4.4.2"
resolved "https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99"
integrity sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=

lodash.ismatch@^4.4.0:
version "4.4.0"
resolved "https://registry.yarnpkg.com/lodash.ismatch/-/lodash.ismatch-4.4.0.tgz#756cb5150ca3ba6f11085a78849645f188f85f37"
Expand All @@ -4125,12 +4130,7 @@ lodash.truncate@^4.4.2:
resolved "https://registry.yarnpkg.com/lodash.truncate/-/lodash.truncate-4.4.2.tgz#5a350da0b1113b837ecfffd5812cbe58d6eae193"
integrity sha1-WjUNoLERO4N+z//VgSy+WNbq4ZM=

lodash.zip@^4.2.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/lodash.zip/-/lodash.zip-4.2.0.tgz#ec6662e4896408ed4ab6c542a3990b72cc080020"
integrity sha1-7GZi5IlkCO1KtsVCo5kLcswIACA=

lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.20, lodash@^4.17.21, lodash@^4.7.0:
lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.21, lodash@^4.7.0:
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
Expand Down Expand Up @@ -5094,7 +5094,7 @@ regex-not@^1.0.0, regex-not@^1.0.2:
extend-shallow "^3.0.2"
safe-regex "^1.1.0"

regexp-tree@^0.1.21, regexp-tree@~0.1.1:
regexp-tree@^0.1.23, regexp-tree@~0.1.1:
version "0.1.23"
resolved "https://registry.yarnpkg.com/regexp-tree/-/regexp-tree-0.1.23.tgz#8a8ce1cc5e971acef62213a7ecdb1f6e18a1f1b2"
integrity sha512-+7HWfb4Bvu8Rs2eQTUIpX9I/PlQkYOuTNbRpKLJlQpSgwSkzFYh+pUj0gtvglnOZLKB6YgnIgRuJ2/IlpL48qw==
Expand Down Expand Up @@ -5351,7 +5351,7 @@ semver-regex@^3.1.2:
resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7"
integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==

semver@7.3.5, semver@^7.1.1, semver@^7.2.1, semver@^7.3.2, semver@^7.3.4:
semver@7.3.5, semver@^7.1.1, semver@^7.2.1, semver@^7.3.2, semver@^7.3.4, semver@^7.3.5:
version "7.3.5"
resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.5.tgz#0b621c879348d8998e4b0e4be94b3f12e6018ef7"
integrity sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==
Expand Down

0 comments on commit 042a31d

Please sign in to comment.