Skip to content

Commit

Permalink
fix: bump (dev)Dependencies, apply stricter rules (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
JounQin committed May 29, 2021
1 parent 38dba0b commit 866f32f
Show file tree
Hide file tree
Showing 8 changed files with 2,651 additions and 4,360 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/ci.yml
@@ -0,0 +1,41 @@
name: CI

on: [push, pull_request]

jobs:
default:
strategy:
matrix:
node:
- 12
- 14
- 16
os: [macOS-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2

- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Dependencies
run: yarn --frozen-lockfile

- name: Build, Lint and Test
run: yarn run-s build lint test typecov
env:
EFF_NO_LINK_RULES: 'true'
PARSER_NO_WATCH: 'true'
28 changes: 0 additions & 28 deletions .github/workflows/nodejs.yml

This file was deleted.

1 change: 0 additions & 1 deletion .huskyrc.js

This file was deleted.

1 change: 1 addition & 0 deletions .simple-git-hooks.js
@@ -0,0 +1 @@
module.exports = require('@1stg/simple-git-hooks')
2 changes: 1 addition & 1 deletion README.md
@@ -1,6 +1,6 @@
# eslint-import-resolver-typescript

[![GitHub Actions](https://github.com/alexgorbatchev/eslint-import-resolver-typescript/workflows/Node%20CI/badge.svg)](https://github.com/alexgorbatchev/eslint-import-resolver-typescript/actions)
[![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)
[![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)
[![npm](https://img.shields.io/npm/v/eslint-import-resolver-typescript.svg)](https://www.npmjs.com/package/eslint-import-resolver-typescript)
[![GitHub Release](https://img.shields.io/github/release/alexgorbatchev/eslint-import-resolver-typescript)](https://github.com/alexgorbatchev/eslint-import-resolver-typescript/releases)
Expand Down
44 changes: 25 additions & 19 deletions package.json
Expand Up @@ -17,8 +17,8 @@
"fesm5": "lib/esm",
"types": "lib",
"files": [
"!*.tsbuildinfo",
"lib"
"lib",
"!*.tsbuildinfo"
],
"keywords": [
"typescript",
Expand All @@ -32,11 +32,10 @@
"build:r": "r",
"build:ts": "tsc -b",
"lint": "run-p lint:*",
"lint:es": "cross-env PARSER_NO_WATCH=true eslint src --cache --ext md,js,ts -f friendly",
"lint:tsc": "tsc --incremental false --noEmit",
"prepare": "yarn-deduplicate || exit 0",
"lint:es": "eslint src --cache -f friendly",
"lint:tsc": "tsc --noEmit",
"prepare": "simple-git-hooks && yarn-deduplicate --strategy fewer || exit 0",
"prepublishOnly": "yarn build",
"pretest": "r",
"release": "sh scripts/release.sh",
"test": "run-p test:*",
"test:multipleEslintrcs": "eslint --ext ts,tsx tests/multipleEslintrcs",
Expand All @@ -46,41 +45,48 @@
"test:withPathsAndNestedBaseUrl": "eslint --ext ts,tsx tests/withPathsAndNestedBaseUrl",
"test:withQuerystring": "eslint --ext ts,tsx tests/withQuerystring",
"test:withoutPaths": "eslint --ext ts,tsx tests/withoutPaths",
"type-coverage": "type-coverage --cache --detail --ignore-catch --strict --update"
"typecov": "type-coverage"
},
"peerDependencies": {
"eslint": "*",
"eslint-plugin-import": "*"
},
"dependencies": {
"debug": "^4.3.1",
"glob": "^7.1.6",
"glob": "^7.1.7",
"is-glob": "^4.0.1",
"resolve": "^1.20.0",
"tsconfig-paths": "^3.9.0"
},
"devDependencies": {
"@1stg/lib-config": "^1.0.1",
"@1stg/lib-config": "^2.1.0",
"@types/debug": "^4.1.5",
"@types/glob": "^7.1.3",
"@types/is-glob": "^4.0.1",
"@types/node": "^14.14.28",
"@types/resolve": "^1.19.0",
"@types/node": "^15.6.1",
"@types/resolve": "^1.20.0",
"@types/unist": "^2.0.3",
"dummy.js": "link:dummy.js",
"eslint-import-resolver-typescript": "link:.",
"npm-run-all": "^4.1.5",
"react": "^17.0.1",
"standard-version": "^9.1.0",
"type-coverage": "^2.14.9",
"typescript": "^4.1.5",
"yarn-deduplicate": "^3.1.0"
"react": "^17.0.2",
"standard-version": "^9.3.0",
"type-coverage": "^2.17.5",
"typescript": "^4.3.2"
},
"resolutions": {
"eslint-import-resolver-typescript": "link:.",
"prettier": "^2.2.1"
"prettier": "^2.3.0"
},
"typeCoverage": {
"atLeast": 99.28
"atLeast": 99.28,
"cache": true,
"detail": true,
"ignoreAsAssertion": true,
"ignoreCatch": true,
"ignoreFiles": [
"**/*.d.ts"
],
"strict": true,
"update": true
}
}
25 changes: 12 additions & 13 deletions src/index.ts
Expand Up @@ -19,7 +19,7 @@ const defaultExtensions = [
'.ts',
'.tsx',
'.d.ts',
// eslint-disable-next-line node/no-deprecated-api
// eslint-disable-next-line node/no-deprecated-api, sonar/deprecation
...Object.keys(require.extensions),
'.jsx',
]
Expand All @@ -31,8 +31,8 @@ export interface TsResolverOptions {
/**
* @deprecated use `project` instead
*/
directory?: string | string[]
project?: string | string[]
directory?: string[] | string
project?: string[] | string
extensions?: string[]
packageFilter?: (pkg: Record<string, string>) => Record<string, string>
}
Expand All @@ -50,7 +50,7 @@ export function resolve(
found: boolean
path?: string | null
} {
options = options || {}
options = options ?? {}

log('looking for:', source)

Expand All @@ -75,10 +75,10 @@ export function resolve(
// note that even if we map the path, we still need to do a final resolve
let foundNodePath: string | null | undefined
try {
foundNodePath = tsResolve(mappedPath || source, {
extensions: options.extensions || defaultExtensions,
foundNodePath = tsResolve(mappedPath ?? source, {
extensions: options.extensions ?? defaultExtensions,
basedir: path.dirname(path.resolve(file)),
packageFilter: options.packageFilter || packageFilterDefault,
packageFilter: options.packageFilter ?? packageFilterDefault,
})
} catch {
foundNodePath = null
Expand Down Expand Up @@ -196,12 +196,14 @@ function initMappers(options: TsResolverOptions) {
return
}

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

if (!options.project) {
// eslint-disable-next-line sonar/deprecation
options.project = options.directory
}
}
Expand All @@ -219,25 +221,22 @@ function initMappers(options: TsResolverOptions) {
(paths, path) => [...paths, ...(isGlob(path) ? globSync(path) : [path])],
[],
)
// eslint-disable-next-line unicorn/no-fn-reference-in-iterator
.map(loadConfig)
// eslint-disable-next-line unicorn/no-fn-reference-in-iterator
.filter(isConfigLoaderSuccessResult)
.map(configLoaderResult => {
const matchPath = createExtendedMatchPath(
configLoaderResult.absoluteBaseUrl,
configLoaderResult.paths,
)

return (source: string) => {
return (source: string) =>
// look for files based on setup tsconfig "paths"
return matchPath(
matchPath(
source,
undefined,
undefined,
options.extensions || defaultExtensions,
options.extensions ?? defaultExtensions,
)
}
})

mappersBuildForOptions = options
Expand Down

0 comments on commit 866f32f

Please sign in to comment.