Skip to content

Commit 866f32f

Browse files
authoredMay 29, 2021
fix: bump (dev)Dependencies, apply stricter rules (#75)
1 parent 38dba0b commit 866f32f

File tree

8 files changed

+2651
-4360
lines changed

8 files changed

+2651
-4360
lines changed
 

‎.github/workflows/ci.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: CI
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
default:
7+
strategy:
8+
matrix:
9+
node:
10+
- 12
11+
- 14
12+
- 16
13+
os: [macOS-latest]
14+
runs-on: ${{ matrix.os }}
15+
steps:
16+
- uses: actions/checkout@v2
17+
18+
- uses: actions/setup-node@v2
19+
with:
20+
node-version: ${{ matrix.node }}
21+
22+
- name: Get yarn cache directory path
23+
id: yarn-cache-dir-path
24+
run: echo "::set-output name=dir::$(yarn cache dir)"
25+
26+
- uses: actions/cache@v2
27+
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
28+
with:
29+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
30+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
31+
restore-keys: |
32+
${{ runner.os }}-yarn-
33+
34+
- name: Install Dependencies
35+
run: yarn --frozen-lockfile
36+
37+
- name: Build, Lint and Test
38+
run: yarn run-s build lint test typecov
39+
env:
40+
EFF_NO_LINK_RULES: 'true'
41+
PARSER_NO_WATCH: 'true'

‎.github/workflows/nodejs.yml

-28
This file was deleted.

‎.huskyrc.js

-1
This file was deleted.

‎.simple-git-hooks.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require('@1stg/simple-git-hooks')

‎README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# eslint-import-resolver-typescript
22

3-
[![GitHub Actions](https://github.com/alexgorbatchev/eslint-import-resolver-typescript/workflows/Node%20CI/badge.svg)](https://github.com/alexgorbatchev/eslint-import-resolver-typescript/actions)
3+
[![GitHub Actions](https://github.com/alexgorbatchev/eslint-import-resolver-typescript/workflows/CI/badge.svg)](https://github.com/alexgorbatchev/eslint-import-resolver-typescript/actions/workflows/ci.yml)
44
[![type-coverage](https://img.shields.io/badge/dynamic/json.svg?label=type-coverage&prefix=%E2%89%A5&suffix=%&query=$.typeCoverage.atLeast&uri=https%3A%2F%2Fraw.githubusercontent.com%2Falexgorbatchev%2Feslint-import-resolver-typescript%2Fmaster%2Fpackage.json)](https://github.com/plantain-00/type-coverage)
55
[![npm](https://img.shields.io/npm/v/eslint-import-resolver-typescript.svg)](https://www.npmjs.com/package/eslint-import-resolver-typescript)
66
[![GitHub Release](https://img.shields.io/github/release/alexgorbatchev/eslint-import-resolver-typescript)](https://github.com/alexgorbatchev/eslint-import-resolver-typescript/releases)

‎package.json

+25-19
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
"fesm5": "lib/esm",
1818
"types": "lib",
1919
"files": [
20-
"!*.tsbuildinfo",
21-
"lib"
20+
"lib",
21+
"!*.tsbuildinfo"
2222
],
2323
"keywords": [
2424
"typescript",
@@ -32,11 +32,10 @@
3232
"build:r": "r",
3333
"build:ts": "tsc -b",
3434
"lint": "run-p lint:*",
35-
"lint:es": "cross-env PARSER_NO_WATCH=true eslint src --cache --ext md,js,ts -f friendly",
36-
"lint:tsc": "tsc --incremental false --noEmit",
37-
"prepare": "yarn-deduplicate || exit 0",
35+
"lint:es": "eslint src --cache -f friendly",
36+
"lint:tsc": "tsc --noEmit",
37+
"prepare": "simple-git-hooks && yarn-deduplicate --strategy fewer || exit 0",
3838
"prepublishOnly": "yarn build",
39-
"pretest": "r",
4039
"release": "sh scripts/release.sh",
4140
"test": "run-p test:*",
4241
"test:multipleEslintrcs": "eslint --ext ts,tsx tests/multipleEslintrcs",
@@ -46,41 +45,48 @@
4645
"test:withPathsAndNestedBaseUrl": "eslint --ext ts,tsx tests/withPathsAndNestedBaseUrl",
4746
"test:withQuerystring": "eslint --ext ts,tsx tests/withQuerystring",
4847
"test:withoutPaths": "eslint --ext ts,tsx tests/withoutPaths",
49-
"type-coverage": "type-coverage --cache --detail --ignore-catch --strict --update"
48+
"typecov": "type-coverage"
5049
},
5150
"peerDependencies": {
5251
"eslint": "*",
5352
"eslint-plugin-import": "*"
5453
},
5554
"dependencies": {
5655
"debug": "^4.3.1",
57-
"glob": "^7.1.6",
56+
"glob": "^7.1.7",
5857
"is-glob": "^4.0.1",
5958
"resolve": "^1.20.0",
6059
"tsconfig-paths": "^3.9.0"
6160
},
6261
"devDependencies": {
63-
"@1stg/lib-config": "^1.0.1",
62+
"@1stg/lib-config": "^2.1.0",
6463
"@types/debug": "^4.1.5",
6564
"@types/glob": "^7.1.3",
6665
"@types/is-glob": "^4.0.1",
67-
"@types/node": "^14.14.28",
68-
"@types/resolve": "^1.19.0",
66+
"@types/node": "^15.6.1",
67+
"@types/resolve": "^1.20.0",
6968
"@types/unist": "^2.0.3",
7069
"dummy.js": "link:dummy.js",
7170
"eslint-import-resolver-typescript": "link:.",
72-
"npm-run-all": "^4.1.5",
73-
"react": "^17.0.1",
74-
"standard-version": "^9.1.0",
75-
"type-coverage": "^2.14.9",
76-
"typescript": "^4.1.5",
77-
"yarn-deduplicate": "^3.1.0"
71+
"react": "^17.0.2",
72+
"standard-version": "^9.3.0",
73+
"type-coverage": "^2.17.5",
74+
"typescript": "^4.3.2"
7875
},
7976
"resolutions": {
8077
"eslint-import-resolver-typescript": "link:.",
81-
"prettier": "^2.2.1"
78+
"prettier": "^2.3.0"
8279
},
8380
"typeCoverage": {
84-
"atLeast": 99.28
81+
"atLeast": 99.28,
82+
"cache": true,
83+
"detail": true,
84+
"ignoreAsAssertion": true,
85+
"ignoreCatch": true,
86+
"ignoreFiles": [
87+
"**/*.d.ts"
88+
],
89+
"strict": true,
90+
"update": true
8591
}
8692
}

‎src/index.ts

+12-13
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const defaultExtensions = [
1919
'.ts',
2020
'.tsx',
2121
'.d.ts',
22-
// eslint-disable-next-line node/no-deprecated-api
22+
// eslint-disable-next-line node/no-deprecated-api, sonar/deprecation
2323
...Object.keys(require.extensions),
2424
'.jsx',
2525
]
@@ -31,8 +31,8 @@ export interface TsResolverOptions {
3131
/**
3232
* @deprecated use `project` instead
3333
*/
34-
directory?: string | string[]
35-
project?: string | string[]
34+
directory?: string[] | string
35+
project?: string[] | string
3636
extensions?: string[]
3737
packageFilter?: (pkg: Record<string, string>) => Record<string, string>
3838
}
@@ -50,7 +50,7 @@ export function resolve(
5050
found: boolean
5151
path?: string | null
5252
} {
53-
options = options || {}
53+
options = options ?? {}
5454

5555
log('looking for:', source)
5656

@@ -75,10 +75,10 @@ export function resolve(
7575
// note that even if we map the path, we still need to do a final resolve
7676
let foundNodePath: string | null | undefined
7777
try {
78-
foundNodePath = tsResolve(mappedPath || source, {
79-
extensions: options.extensions || defaultExtensions,
78+
foundNodePath = tsResolve(mappedPath ?? source, {
79+
extensions: options.extensions ?? defaultExtensions,
8080
basedir: path.dirname(path.resolve(file)),
81-
packageFilter: options.packageFilter || packageFilterDefault,
81+
packageFilter: options.packageFilter ?? packageFilterDefault,
8282
})
8383
} catch {
8484
foundNodePath = null
@@ -196,12 +196,14 @@ function initMappers(options: TsResolverOptions) {
196196
return
197197
}
198198

199+
// eslint-disable-next-line sonar/deprecation
199200
if (options.directory) {
200201
console.warn(
201202
`[${IMPORTER_NAME}]: option \`directory\` is deprecated, please use \`project\` instead`,
202203
)
203204

204205
if (!options.project) {
206+
// eslint-disable-next-line sonar/deprecation
205207
options.project = options.directory
206208
}
207209
}
@@ -219,25 +221,22 @@ function initMappers(options: TsResolverOptions) {
219221
(paths, path) => [...paths, ...(isGlob(path) ? globSync(path) : [path])],
220222
[],
221223
)
222-
// eslint-disable-next-line unicorn/no-fn-reference-in-iterator
223224
.map(loadConfig)
224-
// eslint-disable-next-line unicorn/no-fn-reference-in-iterator
225225
.filter(isConfigLoaderSuccessResult)
226226
.map(configLoaderResult => {
227227
const matchPath = createExtendedMatchPath(
228228
configLoaderResult.absoluteBaseUrl,
229229
configLoaderResult.paths,
230230
)
231231

232-
return (source: string) => {
232+
return (source: string) =>
233233
// look for files based on setup tsconfig "paths"
234-
return matchPath(
234+
matchPath(
235235
source,
236236
undefined,
237237
undefined,
238-
options.extensions || defaultExtensions,
238+
options.extensions ?? defaultExtensions,
239239
)
240-
}
241240
})
242241

243242
mappersBuildForOptions = options

‎yarn.lock

+2,571-4,298
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)
Please sign in to comment.