Skip to content

Commit

Permalink
chore: prepare 74.0.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed Aug 4, 2018
1 parent 41e47ed commit 02d6027
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 65 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org). Except add new
rule (it is breaking changed by default).

## 74.0.0 - 2018-08-04

- Added: `no-async-promise-executor` rule.
- Added: `require-atomic-updates` rule.
- Added: `require-unicode-regexp` rule.
- Added: `no-misleading-character-class` rule.
- Chore: minimum require `eslint` version is now `^5.3.0`.

## 73.0.0 - 2018-07-30

- Chore: minimum require `eslint-plugin-unicorn` version is now `^5.0.0`.
Expand Down
27 changes: 17 additions & 10 deletions __tests__/fixtures/good.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ const quotedBar = `'this' is "quoted"`;

arrayVariable.push(stringVariable);

const console = {
log(message) {
return message;
}
};

function getKey(prefix = "", key = null) {
let realKey = key || null;

Expand Down Expand Up @@ -95,7 +101,7 @@ const obj = {
[`prop_${(() => 42)()}`]: 42
};

console.log(obj); // eslint-disable-line no-console
console.log(obj);

const has = Object.prototype.hasOwnProperty;

Expand Down Expand Up @@ -424,14 +430,13 @@ class PolygonWithBody {
}
}

// eslint-disable-next-line no-console
console.log(PolygonWithBody.area());

const squareNotNamed = new PolygonNotNamed(10, 10);
const squareNamed = new PolygonNamed(10, 10);
const squareWithBody = new PolygonWithBody(10, 10);

console.log(squareNotNamed, squareNamed, squareWithBody); // eslint-disable-line no-console
console.log(squareNotNamed, squareNamed, squareWithBody);

function FooNewTarget() {
if (!new.target) {
Expand All @@ -441,7 +446,7 @@ function FooNewTarget() {
// All good
}

console.log(new FooNewTarget()); // eslint-disable-line no-console
console.log(new FooNewTarget());

function doSomething() {
return new Promise(resolve => {
Expand Down Expand Up @@ -540,10 +545,12 @@ for (i = 0; i < 10; i++) {

handleHands();

module.exports = { foo };
module.exports.test = { foo };
const exportObject = {};

handleHands();
exportObject.exports = { foo };
exportObject.exports.test = { foo };

handleHands(exportObject);

let xBar = 1;
const yBar = 1;
Expand All @@ -567,9 +574,9 @@ try {
}
}

const aReg = /ab+c/i;
const bReg = new RegExp("ab+c", "i");
const cReg = new RegExp(/ab+c/, "i");
const aReg = /ab+c/iu;
const bReg = new RegExp("ab+c", "iu");
const cReg = new RegExp(/ab+c/iu, "iu");

foo(aReg, bReg, cReg);

Expand Down
30 changes: 16 additions & 14 deletions __tests__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function isObject(obj) {
}

function dash2CamelCase(input) {
return input.replace(/-([a-z])/g, found => found[1].toUpperCase());
return input.replace(/-([a-z])/gu, found => found[1].toUpperCase());
}

test("should the config is an object", t => {
Expand Down Expand Up @@ -45,7 +45,7 @@ test("should all configs are present in exports", t => {
});

test("should load the `all` plugin config in the `eslint` to validate all rule syntax is correct", t => {
const config = configs.all;
const config = Object.assign({}, configs.all);
const { plugins } = config;

t.deepEqual(plugins, [
Expand Down Expand Up @@ -78,7 +78,7 @@ test("should load the `all` plugin config in the `eslint` to validate all rule s
});

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

t.true(hasAvaPlugin, "there is ava plugin");
Expand All @@ -102,7 +102,7 @@ test("should load the `ava` plugin config in `eslint` to validate all rule synta
});

test("should load the `core` plugin config in `eslint` to validate all rule syntax is correct", t => {
const config = configs.core;
const config = Object.assign({}, configs.core);
const hasUnicornPlugin = config.plugins.indexOf("unicorn") !== -1;
const hasImportPlugin = config.plugins.indexOf("import") !== -1;

Expand All @@ -125,7 +125,7 @@ test("should load the `core` plugin config in `eslint` to validate all rule synt
});

test("should load the `es5` plugin config in eslint to validate all rule syntax is correct", t => {
const config = configs.es5;
const config = Object.assign({}, configs.es5);
const cli = new eslint.CLIEngine({
baseConfig: config,
useEslintrc: false
Expand All @@ -142,7 +142,7 @@ test("should load the `es5` plugin config in eslint to validate all rule syntax
});

test("should load the `esnext` plugin config in `eslint` to validate all rule syntax is correct", t => {
const config = configs.esnext;
const config = Object.assign({}, configs.esnext);
const hasPromisePlugin = config.plugins.indexOf("promise") !== -1;

t.true(hasPromisePlugin, "there is promise plugin");
Expand All @@ -165,7 +165,7 @@ test("should load the `esnext` plugin config in `eslint` to validate all rule sy
});

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

t.true(hasLodashPlugin, "there is lodash plugin");
Expand All @@ -186,7 +186,7 @@ test("should load the `lodash` plugin config in `eslint` to validate all rule sy
});

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

t.true(hasNodePlugin, "there is node plugin");
Expand All @@ -204,7 +204,7 @@ test("should load the `node` plugin config in `eslint` to validate all rule synt
});

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

Expand Down Expand Up @@ -245,7 +245,7 @@ export default Clock;
});

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

config.rules = {
Expand Down Expand Up @@ -303,7 +303,7 @@ test("should load the `html` plugin config in `eslint` to validate all rule synt
});

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

t.true(hasJestPlugin, "there is jest plugin");
Expand All @@ -324,7 +324,7 @@ test("should load the `jest` plugin config in `eslint` to validate all rule synt
});

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

config.rules = {
Expand Down Expand Up @@ -364,7 +364,9 @@ alert("test");

test("integration tests for `esnext`", t => {
const cli = new eslint.CLIEngine({
baseConfig: configs.esnext,
baseConfig: Object.assign({}, configs.esnext, {
rules: { "max-classes-per-file": "off" }
}),
useEslintrc: false
});

Expand All @@ -379,7 +381,7 @@ test("integration tests for `esnext`", t => {

test("integration tests for `react`", t => {
const cli = new eslint.CLIEngine({
baseConfig: configs.react
baseConfig: Object.assign({}, configs.react)
});

const report = cli.executeOnFiles([
Expand Down
2 changes: 2 additions & 0 deletions lib/config/rules/best-practices.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ module.exports = {
"prefer-promise-reject-errors": ["error", { allowEmptyReject: false }],
// Require use of the second argument for parseInt()
radix: ["error", "always"],
// Enforce the use of `u` flag on RegExp
"require-unicode-regexp": "error",
// Disallow async functions which have no `await` expression
"require-await": "error",
// Requires to declare all vars on top of their containing scope
Expand Down
6 changes: 6 additions & 0 deletions lib/config/rules/possible-errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ module.exports = {
"for-direction": "error",
// Enforce `return` statements in getters
"getter-return": ["error", { allowImplicit: false }],
// Disallow using an async function as a Promise executor
"no-async-promise-executor": "error",
// Disallow `await` inside of loops
"no-await-in-loop": "error",
// Disallow comparing against -0
Expand Down Expand Up @@ -58,6 +60,8 @@ module.exports = {
"no-invalid-regexp": "error",
// Disallow irregular whitespace outside of strings and comments
"no-irregular-whitespace": "error",
// Disallow characters which are made with multiple code points in character class syntax
"no-misleading-character-class": "error",
// Disallow the use of object properties of the global object (Math and JSON) as functions
"no-obj-calls": "error",
// Disallow calling some Object.prototype methods directly on objects
Expand All @@ -76,6 +80,8 @@ module.exports = {
"no-unsafe-finally": "error",
// Disallow negating the left operand of relational operators
"no-unsafe-negation": "error",
// Disallow assignments that can lead to race conditions due to usage of `await` or `yield`
"require-atomic-updates": "error",
// Disallow comparisons with the value NaN
"use-isnan": "error",
// Ensure JSDoc comments are valid
Expand Down
Loading

0 comments on commit 02d6027

Please sign in to comment.