Skip to content

Commit 0e7cfe3

Browse files
SukkaWJounQin
andcommitted
feat!: bump semver, remove unnecessary dependencies (#11)
Co-authored-by: JounQin <[email protected]>
1 parent dedec3a commit 0e7cfe3

19 files changed

+66
-45
lines changed

.github/workflows/node-4+.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ jobs:
1717
with:
1818
versionsAsRoot: true
1919
type: majors
20-
preset: '>= 6' # preset: '>=4' # see https://github.com/import-js/eslint-plugin-import/issues/2053
20+
# preset: '>= 6' # preset: '>=4' # see https://github.com/import-js/eslint-plugin-import/issues/2053
21+
# target Node.js 12 now, see https://github.com/un-es/eslint-plugin-i/issues/10 & https://github.com/un-es/eslint-plugin-i/pull/11
22+
preset: '>= 12'
2123

2224
latest:
2325
needs: [matrix]
@@ -31,11 +33,6 @@ jobs:
3133
eslint:
3234
- 8
3335
- 7
34-
- 6
35-
- 5
36-
- 4
37-
- 3
38-
- 2
3936
include:
4037
- node-version: 'lts/*'
4138
eslint: 7

package.json

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "A fork of `eslint-plugin-import` using `get-tsconfig` to replace `tsconfig-paths` and heavy `typescript` under the hood.",
55
"funding": "https://opencollective.com/unts",
66
"engines": {
7-
"node": ">=4"
7+
"node": ">=12"
88
},
99
"main": "lib/index.js",
1010
"directories": {
@@ -85,6 +85,7 @@
8585
"fs-copy-file-sync": "^1.1.1",
8686
"glob": "^7.2.3",
8787
"in-publish": "^2.0.1",
88+
"is-core-module": "^2.12.1",
8889
"linklocal": "^2.8.2",
8990
"lodash.isarray": "^4.0.0",
9091
"mocha": "^3.5.3",
@@ -98,26 +99,17 @@
9899
"typescript-eslint-parser": "^15 || ^20 || ^22"
99100
},
100101
"peerDependencies": {
101-
"eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8"
102+
"eslint": "^7.2.0 || ^8"
102103
},
103104
"dependencies": {
104-
"array-includes": "^3.1.6",
105-
"array.prototype.findlastindex": "^1.2.2",
106-
"array.prototype.flat": "^1.3.1",
107-
"array.prototype.flatmap": "^1.3.1",
108105
"debug": "^3.2.7",
109106
"doctrine": "^2.1.0",
110107
"eslint-import-resolver-node": "^0.3.7",
111108
"eslint-module-utils": "^2.8.0",
112-
"get-tsconfig": "^4.6.0",
113-
"has": "^1.0.3",
114-
"is-core-module": "^2.12.1",
109+
"get-tsconfig": "^4.6.2",
115110
"is-glob": "^4.0.3",
116111
"minimatch": "^3.1.2",
117-
"object.fromentries": "^2.0.6",
118-
"object.groupby": "^1.0.0",
119-
"object.values": "^1.1.6",
120112
"resolve": "^1.22.3",
121-
"semver": "^6.3.1"
113+
"semver": "^7.5.3"
122114
}
123115
}

resolvers/webpack/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ const fs = require('fs');
1010
const isCore = require('is-core-module');
1111
const resolve = require('resolve');
1212
const semver = require('semver');
13-
const has = require('has');
1413
const isRegex = require('is-regex');
1514

15+
const has = Function.bind.bind(Function.prototype.call)(Object.prototype.hasOwnProperty);
16+
1617
const log = require('debug')('eslint-plugin-import:resolver:webpack');
1718

1819
exports.interfaceVersion = 2;

src/ExportMap.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import * as unambiguous from 'eslint-module-utils/unambiguous';
1717

1818
import { getTsconfig } from 'get-tsconfig';
1919

20-
import includes from 'array-includes';
20+
const includes = Function.bind.bind(Function.prototype.call)(Array.prototype.includes);
2121

2222
const log = debug('eslint-plugin-import:ExportMap');
2323

src/core/importType.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
import { isAbsolute as nodeIsAbsolute, relative, resolve as nodeResolve } from 'path';
2-
import isCoreModule from 'is-core-module';
32

43
import resolve from 'eslint-module-utils/resolve';
54
import { getContextPackagePath } from './packagePath';
5+
import { Module } from 'module';
6+
7+
const isCoreModule = (pkg) => Module.builtinModules.includes(
8+
pkg.startsWith('node:')
9+
? pkg.slice(5)
10+
: pkg,
11+
);
612

713
function baseModule(name) {
814
if (isScoped(name)) {

src/rules/export.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import ExportMap, { recursivePatternCapture } from '../ExportMap';
22
import docsUrl from '../docsUrl';
3-
import includes from 'array-includes';
4-
import flatMap from 'array.prototype.flatmap';
3+
4+
const includes = Function.bind.bind(Function.prototype.call)(Array.prototype.includes);
5+
const flatMap = Function.bind.bind(Function.prototype.call)(Array.prototype.flatMap);
56

67
/*
78
Notes on TypeScript namespaces aka TSModuleDeclaration:

src/rules/exports-last.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
1-
import findLastIndex from 'array.prototype.findlastindex';
2-
31
import docsUrl from '../docsUrl';
42

3+
const findLastIndex = (array, predicate) => {
4+
let i = array.length - 1;
5+
while (i >= 0) {
6+
if (predicate(array[i])) {
7+
return i;
8+
}
9+
i--;
10+
}
11+
return -1;
12+
};
13+
514
function isNonExportStatement({ type }) {
615
return type !== 'ExportDefaultDeclaration'
716
&& type !== 'ExportNamedDeclaration'

src/rules/group-exports.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import docsUrl from '../docsUrl';
2-
import values from 'object.values';
3-
import flat from 'array.prototype.flat';
2+
3+
const { values } = Object;
4+
const flat = Function.bind.bind(Function.prototype.call)(Array.prototype.flat);
45

56
const meta = {
67
type: 'suggestion',

src/rules/no-anonymous-default-export.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@
33
* @author Duncan Beevers
44
*/
55

6-
import has from 'has';
7-
import values from 'object.values';
8-
import fromEntries from 'object.fromentries';
9-
106
import docsUrl from '../docsUrl';
117

8+
const has = Function.bind.bind(Function.prototype.call)(Object.prototype.hasOwnProperty);
9+
const { fromEntries, values } = Object;
10+
1211
const defs = {
1312
ArrayExpression: {
1413
option: 'allowArray',

src/rules/no-unused-modules.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ import resolve from 'eslint-module-utils/resolve';
99
import visit from 'eslint-module-utils/visit';
1010
import { dirname, join } from 'path';
1111
import readPkgUp from 'eslint-module-utils/readPkgUp';
12-
import values from 'object.values';
13-
import includes from 'array-includes';
14-
import flatMap from 'array.prototype.flatmap';
12+
13+
const { values } = Object;
14+
const includes = Function.bind.bind(Function.prototype.call)(Array.prototype.includes);
15+
const flatMap = Function.bind.bind(Function.prototype.call)(Array.prototype.flatMap);
1516

1617
import Exports, { recursivePatternCapture } from '../ExportMap';
1718
import docsUrl from '../docsUrl';

0 commit comments

Comments
 (0)