Skip to content

Commit

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

## 91.1.0 - 2018-12-07

- Added: `utils.modifyPresetRules("presetName", callback)` helper (allow enable/disable preset rules).

## 91.0.0 - 2018-12-07

- Changed: `react` present doesn't extend `esnext` preset.
Expand Down
23 changes: 23 additions & 0 deletions __tests__/utils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import test from "ava";
import { utils } from "..";

test("modifyPresetRules", t => {
const modifiedNodePresetRules = utils.modifyPresetRules("node", () => false);

// Specify rule
t.true(modifiedNodePresetRules["global-require"] === false);
// From extend plugin
t.true(modifiedNodePresetRules["node/no-deprecated-api"] === false);

const modifiedEsnextPresetRules = utils.modifyPresetRules(
"esnext",
() => false
);

// Specify rule
t.true(modifiedEsnextPresetRules["consistent-return"] === false);
// From extend plugin
t.true(modifiedEsnextPresetRules["promise/catch-or-return"] === false);
// From `eslint:recommended`
t.true(modifiedEsnextPresetRules["no-unreachable"] === false);
});
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const lodash = require("./lib/config/lodash");
const markdown = require("./lib/config/markdown");
const node = require("./lib/config/node");
const react = require("./lib/config/react");
const utils = require("./lib/utils");

const configs = {
all,
Expand All @@ -28,5 +29,5 @@ const configs = {

module.exports = {
configs,
rules: {}
utils
};
7 changes: 0 additions & 7 deletions lib/.eslintrc.json

This file was deleted.

22 changes: 22 additions & 0 deletions lib/utils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
"use strict";

const eslint = require("eslint");
const path = require("path");

function modifyPresetRules(presetName, modificator) {
// eslint-disable-next-line import/no-dynamic-require, global-require
const config = require(path.resolve(__dirname, "config", presetName));
const cli = new eslint.CLIEngine({
baseConfig: config,
useEslintrc: false
});
const presetRules = cli.config.baseConfig.rules;

Object.keys(presetRules).forEach(rule => {
presetRules[rule] = modificator(presetRules[rule]);
});

return presetRules;
}

module.exports = { modifyPresetRules };
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.

12 changes: 11 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-plugin-itgalaxy",
"version": "91.0.0",
"version": "91.1.0",
"description": "Itgalaxy org's ESLint rules and configs.",
"keywords": [
"eslint",
Expand Down Expand Up @@ -103,6 +103,16 @@
"./lib/config/markdown.js"
],
"overrides": [
{
"files": [
"lib/config/**/*.{js,mjs,jsx}"
],
"rules": {
"quotes": "off",
"sort-keys": "off",
"quote-props": ["error", "always"]
}
},
{
"files": [
"**/__tests__/**/*.{js,mjs,jsx}"
Expand Down

0 comments on commit ec63fb8

Please sign in to comment.