Skip to content

Commit 5eb4874

Browse files
committed
fix(deps): bump configurations, use resolutions to simplify tests
1 parent 702f390 commit 5eb4874

File tree

5 files changed

+156
-83
lines changed

5 files changed

+156
-83
lines changed

.github/workflows/nodejs.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ jobs:
2222
- name: build, lint, test
2323
run: |
2424
yarn --frozen-lockfile
25-
yarn lint
2625
yarn build
26+
yarn lint
2727
yarn eslint -f friendly tests/**/*.{ts,tsx}
2828
env:
2929
CI: true

package.json

+16-12
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,19 @@
88
"engines": {
99
"node": ">=4"
1010
},
11-
"main": "lib/cjs.js",
12-
"module": "lib/index.js",
13-
"fesm5": "lib/esm.js",
14-
"es2015": "lib/es2015.js",
15-
"types": "lib/index.d.ts",
11+
"main": "lib/cjs",
12+
"module": "lib",
13+
"fesm5": "lib/esm",
14+
"es2015": "lib/es2015",
15+
"types": "lib",
1616
"files": [
1717
"lib"
1818
],
1919
"scripts": {
20-
"build": "rimraf lib && tsc -b src && r",
20+
"build:ts": "tsc -b src",
21+
"build:bundle": "r",
22+
"build": "run-p build:*",
2123
"lint": "eslint --ext md,js,ts -f friendly --ignore-pattern tests .",
22-
"pretest": "r",
2324
"test": "eslint -f friendly tests/**/*.{ts,tsx}",
2425
"type-coverage": "type-coverage --cache --ignore-catch --detail --strict"
2526
},
@@ -42,14 +43,14 @@
4243
"tsconfig-paths": "^3.9.0"
4344
},
4445
"devDependencies": {
45-
"@1stg/babel-preset": "^0.6.2",
46+
"@1stg/babel-preset": "^0.7.0",
4647
"@1stg/commitlint-config": "^0.1.0",
47-
"@1stg/eslint-config": "^0.12.1",
48+
"@1stg/eslint-config": "^0.12.10",
4849
"@1stg/husky-config": "^0.3.0",
49-
"@1stg/lint-staged": "^0.6.1",
50+
"@1stg/lint-staged": "^0.7.4",
5051
"@1stg/prettier-config": "^0.2.0",
5152
"@1stg/remark-config": "^0.2.1",
52-
"@1stg/rollup-config": "^0.9.4",
53+
"@1stg/rollup-config": "^0.9.5",
5354
"@1stg/tsconfig": "^0.5.1",
5455
"@babel/core": "^7.6.0",
5556
"@commitlint/cli": "^8.2.0",
@@ -64,11 +65,14 @@
6465
"lint-staged": "^9.2.5",
6566
"npm-run-all": "^4.1.5",
6667
"prettier": "^1.18.2",
67-
"rimraf": "^3.0.0",
68+
"react": "^16.9.0",
6869
"rollup": "^1.21.4",
6970
"type-coverage": "^2.3.0",
7071
"typescript": "^3.6.3"
7172
},
73+
"resolutions": {
74+
"eslint-import-resolver-ts": "link:."
75+
},
7276
"typeCoverage": {
7377
"atLeast": 100
7478
}

src/index.ts

-2
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ function getMappedPath(source: string, file: string) {
123123
.map(mapper => mapper(source, file))
124124
.filter(path => !!path)
125125

126-
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
127126
if (paths.length > 1) {
128127
log('found multiple matching ts paths:', paths)
129128
}
@@ -191,7 +190,6 @@ function mangleScopedPackage(moduleName: string) {
191190
if (moduleName.startsWith('@')) {
192191
const replaceSlash = moduleName.replace(path.sep, '__')
193192
if (replaceSlash !== moduleName) {
194-
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
195193
return replaceSlash.slice(1) // Take off the "@"
196194
}
197195
}

tests/baseEslintConfig.js

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
const path = require('path')
2-
3-
module.exports = dirname => ({
1+
module.exports = directory => ({
42
parser: '@typescript-eslint/parser',
53
extends: [
64
'eslint:recommended',
@@ -11,8 +9,8 @@ module.exports = dirname => ({
119
],
1210
settings: {
1311
'import/resolver': {
14-
[path.resolve(__dirname, '../lib/cjs.js')]: {
15-
directory: dirname,
12+
ts: {
13+
directory,
1614
alwaysTryTypes: true,
1715
},
1816
},

0 commit comments

Comments
 (0)