Skip to content

Commit

Permalink
breaking: drop eslint < 7
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Nov 7, 2021
1 parent 378751b commit 87a1468
Show file tree
Hide file tree
Showing 13 changed files with 37 additions and 218 deletions.
5 changes: 1 addition & 4 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
"node": true
},
"parserOptions": {
"ecmaFeatures": {
"impliedStrict": true
},
"ecmaVersion": 2017
"ecmaVersion": 2018
},
"plugins": ["json"],
"root": true
Expand Down
29 changes: 0 additions & 29 deletions .github/workflows/node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,32 +27,9 @@ jobs:
eslint:
- 8
- 7
- 6
- 5
- 4
- 3
include:
- node-version: 14
eslint: 7.7
- node-version: 8
eslint: 6
- node-version: 8
eslint: 5
- node-version: 8
eslint: 4
- node-version: 8
eslint: 3
- node-version: 6
eslint: 5
ajv: 5
- node-version: 6
eslint: 4
- node-version: 6
eslint: 3
- node-version: 4
eslint: 4
- node-version: 4
eslint: 3
exclude:
- node-version: 15
eslint: 8
Expand All @@ -71,12 +48,6 @@ jobs:
node-version: ${{ matrix.node-version }}
skip-ls-check: true
- run: npm install --no-save eslint@${{ matrix.eslint }}
- run: npm install --no-save "ajv@${{ matrix.ajv }}"
if: ${{ !!matrix.ajv }}
- run: npm install --no-save "ajv@5"
if: ${{ !matrix.ajv && matrix.eslint == 4 }}
- run: npm install --no-save "ajv@6"
if: ${{ !matrix.ajv && matrix.eslint == 5 }}
- run: npm install --no-save @eslint/eslintrc@0
if: ${{ matrix.eslint != 8 }}
- run: npm prune > /dev/null
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"commitizen": "^2.10.1",
"create-require": "^1.1.1",
"cz-conventional-changelog": "^2.1.0",
"eslint": "^3.12.0 || ^4 || ^5 || ^6 || ^7 || ^8",
"eslint": "^7 || ^8.2.0",
"eslint-plugin-json": "^3.1.0",
"ghooks": "^2.0.4",
"in-publish": "^2.0.1",
Expand All @@ -65,7 +65,7 @@
"validate-commit-msg": "^2.14.0"
},
"peerDependencies": {
"eslint": "^3.12.0 || ^4 || ^5 || ^6 || ^7 || ^8"
"eslint": "^7 || ^8.2.0"
},
"nyc": {
"exclude": [
Expand Down Expand Up @@ -107,6 +107,6 @@
},
"homepage": "https://github.com/sarbbottam/eslint-find-rules#readme",
"engines": {
"node": ">= 4"
"node": "^10.12.0 || >=12.0.0 || ^14.17.0 || >=16.0.0"
}
}
74 changes: 0 additions & 74 deletions src/lib/normalize-plugin-name.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,80 +27,6 @@ function _getNormalizer() {
getShorthandName: naming.getShorthandName
}
},
// eslint >= 6.1.0
function () {
const normalizer = require('eslint/lib/shared/naming');

return {
normalizePackageName: normalizer.normalizePackageName,
getShorthandName: normalizer.getShorthandName
};
},
// eslint 6.0.0 - 6.0.1
function () {
const normalizer = require('eslint/lib/cli-engine/naming');

return {
normalizePackageName: normalizer.normalizePackageName,
getShorthandName: normalizer.getShorthandName
};
},
// eslint 5
function () {
const normalizer = require('eslint/lib/util/naming');

return {
normalizePackageName: normalizer.normalizePackageName,
getShorthandName: normalizer.getShorthandName
};
},
// eslint 4
function () {
const normalizer = require('eslint/lib/util/naming');

return {
normalizePackageName: normalizer.normalizePackageName,
getShorthandName: normalizer.removeNamespaceFromTerm
};
},
// eslint 3
function () {
const normalizer = require('eslint/lib/config/plugins');

const PLUGIN_NAME_PREFIX = 'eslint-plugin-';

function parsePluginName(pluginName) {
const pluginNamespace = normalizer.getNamespace(pluginName);
const pluginNameWithoutNamespace = normalizer.removeNamespace(pluginName);
const pluginNameWithoutPrefix = normalizer.removePrefix(pluginNameWithoutNamespace);

return {
pluginNamespace,
pluginNameWithoutPrefix
};
}

function normalizePackageName(pluginName) {
const sections = parsePluginName(pluginName);
const longName = sections.pluginNamespace +
PLUGIN_NAME_PREFIX +
sections.pluginNameWithoutPrefix;

return longName;
}

function getShorthandName(pluginName) {
const sections = parsePluginName(pluginName);
const shortName = sections.pluginNamespace + sections.pluginNameWithoutPrefix;

return shortName;
}

return {
normalizePackageName,
getShorthandName
};
}
];

for (const tryEslintVersion of eslintVersionFunctions) {
Expand Down
9 changes: 0 additions & 9 deletions test/fixtures/prior-v5/eslint-dedupe-plugin-rules.json

This file was deleted.

11 changes: 0 additions & 11 deletions test/fixtures/prior-v5/eslint-with-deprecated-rules.json

This file was deleted.

7 changes: 0 additions & 7 deletions test/fixtures/prior-v5/eslint-with-plugin-with-no-rules.json

This file was deleted.

8 changes: 0 additions & 8 deletions test/fixtures/prior-v5/eslint.json

This file was deleted.

5 changes: 0 additions & 5 deletions test/fixtures/prior-v5/eslint.yml

This file was deleted.

5 changes: 0 additions & 5 deletions test/fixtures/prior-v5/eslintrc

This file was deleted.

5 changes: 0 additions & 5 deletions test/fixtures/prior-v5/no-path/index.js

This file was deleted.

7 changes: 0 additions & 7 deletions test/fixtures/prior-v5/no-path/package.json

This file was deleted.

Loading

0 comments on commit 87a1468

Please sign in to comment.