Skip to content

Commit 1a29670

Browse files
chore(release): 100.0.0
1 parent 88a5f11 commit 1a29670

File tree

5 files changed

+209
-167
lines changed

5 files changed

+209
-167
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
55
This project adheres to [Semantic Versioning](http://semver.org). Except add new
66
rule (it is breaking changed by default).
77

8+
## 100.0.0 - 2019-04-03
9+
10+
- Added: `unicorn/prefer-query-selector` rule.
11+
- Added: `unicorn/prefer-node-remove` rule.
12+
- Added: `unicorn/prefer-text-content` rule.
13+
- Added: `unicorn/no-for-loop` rule.
14+
- Added: `unicorn/no-zero-fractions` rule.
15+
- Added: `unicorn/prefer-includes` rule.
16+
- Chore: minimum require `eslint-plugin-unicorn` version is now `^8.0.1`.
17+
818
## 99.0.0 - 2019-03-25
919

1020
- Added: `jest/no-empty-title` rule.

__tests__/index.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ test("should load the `all` plugin config in the `eslint` to validate all rule s
7575

7676
test("should load the `ava` plugin config in `eslint` to validate all rule syntax is correct", t => {
7777
const config = Object.assign({}, configs.ava);
78-
const hasAvaPlugin = config.plugins.indexOf("ava") !== -1;
78+
const hasAvaPlugin = config.plugins.includes("ava");
7979

8080
t.true(hasAvaPlugin, "there is ava plugin");
8181

@@ -99,9 +99,9 @@ test("should load the `ava` plugin config in `eslint` to validate all rule synta
9999

100100
test("should load the `esnext` plugin config in `eslint` to validate all rule syntax is correct", t => {
101101
const config = Object.assign({}, configs.esnext);
102-
const hasUnicornPlugin = config.plugins.indexOf("unicorn") !== -1;
103-
const hasPromisePlugin = config.plugins.indexOf("promise") !== -1;
104-
const hasImportPlugin = config.plugins.indexOf("import") !== -1;
102+
const hasUnicornPlugin = config.plugins.includes("unicorn");
103+
const hasPromisePlugin = config.plugins.includes("promise");
104+
const hasImportPlugin = config.plugins.includes("import");
105105

106106
t.true(hasUnicornPlugin, "there is unicorn plugin");
107107
t.true(hasPromisePlugin, "there is promise plugin");
@@ -126,7 +126,7 @@ test("should load the `esnext` plugin config in `eslint` to validate all rule sy
126126

127127
test("should load the `lodash` plugin config in `eslint` to validate all rule syntax is correct", t => {
128128
const config = Object.assign({}, configs.lodash);
129-
const hasLodashPlugin = config.plugins.indexOf("lodash") !== -1;
129+
const hasLodashPlugin = config.plugins.includes("lodash");
130130

131131
t.true(hasLodashPlugin, "there is lodash plugin");
132132

@@ -147,7 +147,7 @@ test("should load the `lodash` plugin config in `eslint` to validate all rule sy
147147

148148
test("should load the `node` plugin config in `eslint` to validate all rule syntax is correct", t => {
149149
const config = Object.assign({}, configs.node);
150-
const hasNodePlugin = config.plugins.indexOf("node") !== -1;
150+
const hasNodePlugin = config.plugins.includes("node");
151151

152152
t.true(hasNodePlugin, "there is node plugin");
153153

@@ -165,8 +165,8 @@ test("should load the `node` plugin config in `eslint` to validate all rule synt
165165

166166
test("should load the `react` plugin config in `eslint` to validate all rule syntax is correct", t => {
167167
const config = Object.assign({}, configs.react);
168-
const hasReactPlugin = config.plugins.indexOf("react") !== -1;
169-
const hasjsxA11yPlugin = config.plugins.indexOf("jsx-a11y") !== -1;
168+
const hasReactPlugin = config.plugins.includes("react");
169+
const hasjsxA11yPlugin = config.plugins.includes("jsx-a11y");
170170

171171
t.true(hasReactPlugin, "there is react plugin");
172172
t.true(hasjsxA11yPlugin, "there is jsx-a11y plugin");
@@ -206,7 +206,7 @@ module.exports = Clock;
206206

207207
test("should load the `html` plugin config in `eslint` to validate all rule syntax is correct", t => {
208208
const config = Object.assign({}, configs.html);
209-
const hasHTMLPlugin = config.plugins.indexOf("html") !== -1;
209+
const hasHTMLPlugin = config.plugins.includes("html");
210210

211211
config.rules = {
212212
"no-alert": "error"
@@ -264,7 +264,7 @@ test("should load the `html` plugin config in `eslint` to validate all rule synt
264264

265265
test("should load the `jest` plugin config in `eslint` to validate all rule syntax is correct", t => {
266266
const config = Object.assign({}, configs.jest);
267-
const hasJestPlugin = config.plugins.indexOf("jest") !== -1;
267+
const hasJestPlugin = config.plugins.includes("jest");
268268

269269
t.true(hasJestPlugin, "there is jest plugin");
270270

@@ -285,7 +285,7 @@ test("should load the `jest` plugin config in `eslint` to validate all rule synt
285285

286286
test("should load the `markdown` plugin config in `eslint` to validate all rule syntax is correct", t => {
287287
const config = Object.assign({}, configs.markdown);
288-
const hasMarkdownPlugin = config.plugins.indexOf("markdown") !== -1;
288+
const hasMarkdownPlugin = config.plugins.includes("markdown");
289289

290290
config.rules = {
291291
"no-alert": "error"

lib/config/rules/unicorn.js

Lines changed: 51 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -7,67 +7,77 @@ module.exports = {
77
"unicorn/catch-error-name": [
88
"error",
99
{
10-
name: "error",
1110
caughtErrorsIgnorePattern: "^ignore"
1211
}
1312
],
13+
// Enforce correct `Error` subclassing.
14+
"unicorn/custom-error-definition": "error",
15+
// Enforce passing a `message` value when throwing a built-in error.
16+
"unicorn/error-message": "error",
17+
// Require escape sequences to use uppercase values
18+
"unicorn/escape-case": "error",
1419
// Enforce explicitly comparing the `length` property of a value
1520
"unicorn/explicit-length-check": "error",
1621
// Enforce a case style for filenames
1722
"unicorn/filename-case": "off",
23+
// Enforce importing index files with `..`
24+
"unicorn/import-index": "error",
25+
// Enforce the use of `new` for all builtins, except `String`, `Number` and `Boolean`.
26+
"unicorn/new-for-builtins": "error",
1827
// Enforce specifying rules to disable in `eslint-disable` comments
1928
"unicorn/no-abusive-eslint-disable": "error",
20-
// Disallow `process.exit()`
21-
// Use `no-process-exit` `eslint` rule
22-
"unicorn/no-process-exit": "off",
23-
// Require new when throwing an error (fixable)
24-
"unicorn/throw-new-error": "error",
25-
// Enforce lowercase identifier and uppercase value for number literals
26-
// Use `prettier`
27-
"unicorn/number-literal-case": "off",
28-
// Require escape sequences to use uppercase values
29-
"unicorn/escape-case": "error",
3029
// Require `Array.isArray()` instead of `instanceof Array`
3130
"unicorn/no-array-instanceof": "error",
31+
// Do not use leading/trailing space between `console.log` parameters.
32+
"unicorn/no-console-spaces": "error",
33+
// Prevents passing a function reference directly to iterator methods.
34+
"unicorn/no-fn-reference-in-iterator": "off",
35+
// Do not use a `for` loop that can be replaced with a `for-of` loop
36+
"unicorn/no-for-loop": "error",
37+
// Enforce the use of unicode escapes instead of hexadecimal escapes.
38+
"unicorn/no-hex-escape": "error",
3239
// Enforce the use of `Buffer.from()` and `Buffer.alloc()` instead of the deprecated `new Buffer()`
3340
// Use `node/no-deprecated-api` rule.
3441
"unicorn/no-new-buffer": "off",
35-
// Enforce the use of unicode escapes instead of hexadecimal escapes.
36-
"unicorn/no-hex-escape": "error",
37-
// Enforce correct `Error` subclassing.
38-
"unicorn/custom-error-definition": "error",
39-
// Prefer `String#startsWith` & `String#endsWith` over more complex alternatives.
40-
"unicorn/prefer-starts-ends-with": "error",
41-
// Need investigate
42-
// Enforce throwing `TypeError` in type checking conditions.
43-
"unicorn/prefer-type-error": "off",
44-
// Prevents passing a function reference directly to iterator methods.
45-
"unicorn/no-fn-reference-in-iterator": "off",
46-
// Enforce importing index files with `..`
47-
"unicorn/import-index": "error",
48-
// Enforce the use of `new` for all builtins, except `String`, `Number` and `Boolean`.
49-
"unicorn/new-for-builtins": "error",
50-
// Enforce the use of regex shorthands to improve readability.
51-
"unicorn/regex-shorthand": "error",
52-
// Prefer the spread operator over `Array.from()`.
53-
"unicorn/prefer-spread": "error",
54-
// Enforce passing a `message` value when throwing a built-in error.
55-
"unicorn/error-message": "error",
42+
// Disallow `process.exit()`
43+
// Use `no-process-exit` `eslint` rule
44+
"unicorn/no-process-exit": "off",
45+
// Disallow unreadable array destructuring.
46+
"unicorn/no-unreadable-array-destructuring": "off",
5647
// Disallow unsafe regular expressions.
5748
"unicorn/no-unsafe-regex": "off",
49+
// Disallow unused object properties.
50+
"unicorn/no-unused-properties": "off",
51+
// Disallow number literals with zero fractions or dangling dots
52+
"unicorn/no-zero-fractions": "error",
53+
// Enforce lowercase identifier and uppercase value for number literals
54+
// Use `prettier`
55+
"unicorn/number-literal-case": "off",
5856
// Prefer `addEventListener` over `on`-functions.
5957
"unicorn/prefer-add-event-listener": "error",
6058
// Prefer the exponentiation operator over Math.pow()
6159
"unicorn/prefer-exponentiation-operator": "error",
62-
// Do not use leading/trailing space between `console.log` parameters.
63-
"unicorn/no-console-spaces": "error",
64-
// Disallow unreadable array destructuring.
65-
"unicorn/no-unreadable-array-destructuring": "off",
66-
// Disallow unused object properties.
67-
"unicorn/no-unused-properties": "off",
60+
// Prefer `.includes()` over `.indexOf()` when checking for existence or non-existence
61+
"unicorn/prefer-includes": "error",
6862
// Prefer `append` over `appendChild`.
6963
"unicorn/prefer-node-append": "error",
70-
// Prefer `querySelector` over `getElementById`, `querySelectorAll` over g`etElementsByClassName` and `getElementsByTagName`
71-
// Need enable in future
72-
"unicorn/prefer-query-selector": "off"
64+
// Prefer `remove` over `parentNode.removeChild` and `parentElement.removeChild`.
65+
"unicorn/prefer-node-remove": "error",
66+
// Prefer `querySelector` over `getElementById`, `querySelectorAll` over `getElementsByClassName` and `getElementsByTagName`
67+
"unicorn/prefer-query-selector": "error",
68+
// Prefer the spread operator over `Array.from()`.
69+
"unicorn/prefer-spread": "error",
70+
// Prefer `String#startsWith` & `String#endsWith` over more complex alternatives.
71+
"unicorn/prefer-starts-ends-with": "error",
72+
// Prefer `textContent` over `innerText`
73+
"unicorn/prefer-text-content": "error",
74+
// Maybe enable in future
75+
// Enforce throwing `TypeError` in type checking conditions.
76+
"unicorn/prefer-type-error": "off",
77+
// Prevent abbreviations
78+
"unicorn/prevent-abbreviations": "off",
79+
// Enforce the use of regex shorthands to improve readability.
80+
"unicorn/regex-shorthand": "error",
81+
// Require new when throwing an error (fixable)
82+
"unicorn/throw-new-error": "error"
7383
};

0 commit comments

Comments
 (0)