Skip to content

Commit 644d438

Browse files
SukkaWJounQin
andauthored
feat!: bump semver, remove unnecessary dependencies (#11)
Co-authored-by: JounQin <[email protected]>
1 parent 616ac75 commit 644d438

18 files changed

+46
-34
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: 4 additions & 9 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": {
@@ -84,6 +84,7 @@
8484
"fs-copy-file-sync": "^1.1.1",
8585
"glob": "^7.2.3",
8686
"in-publish": "^2.0.1",
87+
"is-core-module": "^2.12.1",
8788
"linklocal": "^2.8.2",
8889
"lodash.isarray": "^4.0.0",
8990
"mocha": "^3.5.3",
@@ -97,23 +98,17 @@
9798
"typescript-eslint-parser": "^15 || ^20 || ^22"
9899
},
99100
"peerDependencies": {
100-
"eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8"
101+
"eslint": "^7.2.0 || ^8"
101102
},
102103
"dependencies": {
103-
"array-includes": "^3.1.6",
104-
"array.prototype.flat": "^1.3.1",
105-
"array.prototype.flatmap": "^1.3.1",
106104
"debug": "^3.2.7",
107105
"doctrine": "^2.1.0",
108106
"eslint-import-resolver-node": "^0.3.7",
109107
"eslint-module-utils": "^2.8.0",
110108
"get-tsconfig": "^4.6.0",
111-
"has": "^1.0.3",
112-
"is-core-module": "^2.12.1",
113109
"is-glob": "^4.0.3",
114110
"minimatch": "^3.1.2",
115-
"object.values": "^1.1.6",
116111
"resolve": "^1.22.3",
117-
"semver": "^6.3.0"
112+
"semver": "^7.5.3"
118113
}
119114
}

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/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: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
*/
55

66
import docsUrl from '../docsUrl';
7-
import has from 'has';
7+
8+
const has = Function.bind.bind(Function.prototype.call)(Object.prototype.hasOwnProperty);
89

910
const defs = {
1011
ArrayExpression: {

src/rules/no-unused-modules.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ import visit from 'eslint-module-utils/visit';
1111
import docsUrl from '../docsUrl';
1212
import { dirname, join } from 'path';
1313
import readPkgUp from 'eslint-module-utils/readPkgUp';
14-
import values from 'object.values';
15-
import includes from 'array-includes';
14+
15+
const { values } = Object;
16+
const includes = Function.bind.bind(Function.prototype.call)(Array.prototype.includes);
1617

1718
let FileEnumerator;
1819
let listFilesToProcess;

src/rules/order.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
'use strict';
22

33
import minimatch from 'minimatch';
4-
import includes from 'array-includes';
54

65
import importType from '../core/importType';
76
import isStaticRequire from '../core/staticRequire';
87
import docsUrl from '../docsUrl';
98

9+
const includes = Function.bind.bind(Function.prototype.call)(Array.prototype.includes);
10+
1011
const defaultGroups = ['builtin', 'external', 'parent', 'sibling', 'index'];
1112

1213
// REPORTING AND FIXING

0 commit comments

Comments
 (0)