Skip to content

Commit

Permalink
fix: ESLint 7.8.0 removes normalization function
Browse files Browse the repository at this point in the history
Issue #331
  • Loading branch information
soda0289 authored and ljharb committed Sep 1, 2020
1 parent 8aaac5b commit bde54d6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
],
"license": "MIT",
"dependencies": {
"@eslint/eslintrc": "^0.1.0",
"cliui": "^3.2.0",
"eslint-rule-documentation": "^1.0.0",
"glob": "^7.1.4",
Expand Down
19 changes: 19 additions & 0 deletions src/lib/normalize-plugin-name.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,25 @@ function _getNormalizer() {
}

const eslintVersionFunctions = [
// eslint >= 7.0.0
function () {
const ESLintExports = require('eslint');

const version = ESLintExports.ESLint.version;

if (!version) {
throw new Error('Unable to find eslint version');
}

const ESLintRC = require('@eslint/eslintrc');

const naming = ESLintRC.Legacy.naming;

return {
normalizePackageName: naming.normalizePackageName,
getShorthandName: naming.getShorthandName
}
},
// eslint >= 6.1.0
function () {
const normalizer = require('eslint/lib/shared/naming');
Expand Down

0 comments on commit bde54d6

Please sign in to comment.