Skip to content

Commit

Permalink
chore: prepare 94.0.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed Dec 11, 2018
1 parent a16443c commit c3084e6
Show file tree
Hide file tree
Showing 13 changed files with 70 additions and 150 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ 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).

## 94.0.0 - 2018-12-11

- Changed: move `unicorn` rules into `esnext` preset.
- Changed: remove `sourceType` from `react` preset.
- Changed: remove `es6` from `jest` preset.
- Changed: remove `es6` from `ava` preset.
- Changed: remove `es6` from `html` preset.
- Fixed: add `jest/globals` to `jest` preset.
- Removed: `globals` from `react` preset.
- Removed: `es5` preset (use `babel` to transpile code in `es5`/`es3` and etc).
- Removed: `core` preset.

## 93.0.0 - 2018-12-11

- Added: `react/forbid-foreign-prop-types` rule.
Expand Down
28 changes: 5 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,7 @@ React-specific rules to those in the ESNext config):

```json
{
"extends": "plugin:itgalaxy/react"
}
```

If working on an ES5 project, extend the ES5 version of the configuration:

```json
{
"extends": "plugin:itgalaxy/es5"
"extends": ["plugin:itgalaxy/esnext", "plugin:itgalaxy/react"]
}
```

Expand All @@ -80,25 +72,17 @@ following configuration file:
"plugin:itgalaxy/esnext",
"plugin:itgalaxy/react",
"plugin:itgalaxy/lodash",
"plugin:itgalaxy/mocha"
"plugin:itgalaxy/jest"
]
}
```

Notice: presets **"plugin:itgalaxy/esnext"** or **"plugin:itgalaxy/es5"** always should be **first**.
Notice: presets **"plugin:itgalaxy/esnext"** should be **first**.

## Provided configurations

This plugin provides the following core configurations:

- [es5](lib/config/es5.js): Use this for legacy projects.

```json
{
"extends": ["plugin:itgalaxy/es5"]
}
```

- [esnext](lib/config/esnext.js): Use this for anything written with ES2015+ features.

```json
Expand Down Expand Up @@ -145,7 +129,7 @@ module.exports = {
};
```

- [node](lib/config/node.js): Use this for nodejs projects.
- [node](lib/config/node.js): Use this for `nodejs` projects.

Example:

Expand All @@ -155,7 +139,7 @@ Example:
}
```

- [react](lib/config/react.js): Use this for React projects.
- [react](lib/config/react.js): Use this for `React` projects.

Example:

Expand All @@ -167,8 +151,6 @@ Example:

- [all](lib/config/all.js): Don't use. It is for internal purposes (testings and tools).

- [core](lib/config/core.js): Don't use. It is for internal purposes (testings and tools).

This plugin also provides the following tool-specific configurations, which can be used on top of the core configurations:

- [AVA](lib/config/ava.js): Use this for projects that use the
Expand Down
50 changes: 7 additions & 43 deletions __tests__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,51 +101,15 @@ test("should load the `ava` plugin config in `eslint` to validate all rule synta
t.is(report.warningCount, 0, "eslint report without warnings");
});

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

t.true(hasUnicornPlugin, "there is unicorn plugin");
t.true(hasImportPlugin, "there is import plugin");

const cli = new eslint.CLIEngine({
baseConfig: config,
useEslintrc: false
});

const report = cli.executeOnText(
'(function() {\n "use strict";\n\n (123).toString();\n})();\n',
"test.js"
);

t.is(report.results.length, 1, "eslint report with one results");
t.is(report.errorCount, 0, "eslint report without errors");
t.is(report.warningCount, 0, "eslint report without warnings");
});

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

const report = cli.executeOnText(
'(function() {\n "use strict";\n\n (123).toString();\n})();\n',
"test.js"
);

t.is(report.results.length, 1, "eslint report with one results");
t.is(report.errorCount, 0, "eslint report without errors");
t.is(report.warningCount, 0, "eslint report without warnings");
});

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

t.true(hasUnicornPlugin, "there is unicorn plugin");
t.true(hasPromisePlugin, "there is promise plugin");
t.true(hasImportPlugin, "there is import plugin");

config.extends = [];

Expand All @@ -155,7 +119,7 @@ test("should load the `esnext` plugin config in `eslint` to validate all rule sy
});

const report = cli.executeOnText(
"let foo = 0;\n\n foo += 1;\n",
"/* global func */\nlet foo = 0;\n\n foo += 1;\n\nfunc(foo);",
"test.js"
);

Expand Down Expand Up @@ -220,7 +184,7 @@ test("should load the `react` plugin config in `eslint` to validate all rule syn

const report = cli.executeOnText(
`
import React from "react";
const React = require("react");
class Clock extends React.Component {
render() {
Expand All @@ -233,7 +197,7 @@ class Clock extends React.Component {
}
}
export default Clock;
module.exports = Clock;
`,
"test.jsx"
Expand Down
9 changes: 1 addition & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

const all = require("./lib/config/all");
const ava = require("./lib/config/ava");
const core = require("./lib/config/core");
const es5 = require("./lib/config/es5");
const esnext = require("./lib/config/esnext");
const html = require("./lib/config/html");
const jest = require("./lib/config/jest");
Expand All @@ -16,8 +14,6 @@ const utils = require("./lib/utils");
const configs = {
all,
ava,
core,
es5,
esnext,
html,
jest,
Expand All @@ -27,7 +23,4 @@ const configs = {
react
};

module.exports = {
configs,
utils
};
module.exports = { configs, utils };
5 changes: 2 additions & 3 deletions lib/config/ava.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
const avaRules = require("./rules/ava");

module.exports = {
env: {
es6: true
},
// `AVA` use own `babel` preset what support es6 syntax with `import` but we disable this because
// you can configure `babel` for `es3`, `es5`, `es6` and other `es` editions.
plugins: ["ava"],
rules: Object.assign({}, avaRules)
};
50 changes: 0 additions & 50 deletions lib/config/core.js

This file was deleted.

7 changes: 0 additions & 7 deletions lib/config/es5.js

This file was deleted.

44 changes: 40 additions & 4 deletions lib/config/esnext.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,55 @@
"use strict";

const path = require("path");
const possibleErrorsRules = require("./rules/possible-errors");
const bestPracticesRules = require("./rules/best-practices");
const strictModeRules = require("./rules/strict-mode");
const variablesRules = require("./rules/variables");
const stylisticIssuesRules = require("./rules/stylistic-issues");
const deprecatedRules = require("./rules/deprecated");
const ecmascript6Rules = require("./rules/ecmascript-6");
const promiseRules = require("./rules/promise");
const unicornRules = require("./rules/unicorn");
const importRules = require("./rules/import");

module.exports = {
env: {
es6: true
},
parser: "babel-eslint",
parserOptions: {
ecmaVersion: 2019,
sourceType: "module",
allowImportExportEverywhere: true
},
plugins: ["promise"],
extends: [path.resolve(__dirname, "./core.js")],
rules: Object.assign({}, ecmascript6Rules, promiseRules)
settings: {
"import/resolver": {
node: {
extensions: [
".mjs",
".js",
".jsx",
".json",
".web.js",
".ios.js",
".android.js"
]
}
},
"import/ignore": ["\\.(coffee|scss|css|less|hbs|svg|json)$"],
"import/extensions": [".mjs", ".js", ".jsx"]
},
plugins: ["unicorn", "promise", "import"],
rules: Object.assign(
{},
possibleErrorsRules,
bestPracticesRules,
strictModeRules,
variablesRules,
stylisticIssuesRules,
deprecatedRules,
ecmascript6Rules,
unicornRules,
promiseRules,
importRules
)
};
3 changes: 0 additions & 3 deletions lib/config/html.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
"use strict";

module.exports = {
env: {
browser: true
},
plugins: ["html"]
};
2 changes: 1 addition & 1 deletion lib/config/jest.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const jestRules = require("./rules/jest");

module.exports = {
env: { es6: true },
env: { "jest/globals": true },
plugins: ["jest"],
rules: Object.assign({}, jestRules)
};
6 changes: 0 additions & 6 deletions lib/config/react.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,11 @@ module.exports = {
},
parserOptions: {
ecmaVersion: 2019,
sourceType: "module",
ecmaFeatures: {
jsx: true
},
allowImportExportEverywhere: true
},
globals: {
fetch: true,
ReactElement: true,
ReactClass: true
},
settings: {
react: {
pragma: "React",
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-plugin-itgalaxy",
"version": "93.0.0",
"version": "94.0.0",
"description": "Itgalaxy org's ESLint rules and configs.",
"keywords": [
"eslint",
Expand Down

0 comments on commit c3084e6

Please sign in to comment.