Skip to content

Commit 28229bf

Browse files
JounQinteoxoy
andauthored
Chore/merge (#27)
Chore/merge Co-authored-by: Teodor Tanasoaia <[email protected]>
2 parents 0cbd385 + 970b2ef commit 28229bf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+7628
-1722
lines changed

Diff for: .commitlintrc

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"extends": [
3+
"@1stg"
4+
]
5+
}

Diff for: .editorconfig

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
tab_width = 2
7+
end_of_line = lf
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true

Diff for: .eslintignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
lib
2+
CHANGELOG.md

Diff for: .eslintrc.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const { js } = require('@1stg/eslint-config/overrides')
2+
3+
module.exports = {
4+
extends: ['@1stg', 'plugin:import/typescript', 'plugin:mdx/recommended'],
5+
overrides: [js],
6+
rules: {
7+
'node/no-unsupported-features/es-syntax': 0,
8+
},
9+
}

Diff for: .github/workflows/nodejs.yml

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Node CI
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
strategy:
8+
matrix:
9+
node: [8.x, 10.x, 12.x]
10+
os: [macOS-latest, ubuntu-latest]
11+
runs-on: ${{ matrix.os }}
12+
steps:
13+
- uses: actions/checkout@v1
14+
- name: Use Node.js ${{ matrix.node }}
15+
uses: actions/setup-node@v1
16+
with:
17+
node-version: ${{ matrix.node }}
18+
- name: setup yarn
19+
run: |
20+
curl -o- -L https://yarnpkg.com/install.sh | bash
21+
export PATH="$HOME/.yarn/bin:$PATH"
22+
- name: build, lint, test
23+
run: |
24+
yarn --frozen-lockfile
25+
yarn build
26+
yarn lint
27+
yarn eslint -f friendly tests/**/*.{ts,tsx}
28+
env:
29+
CI: true
30+
EFF_NO_LINK_RULES: true
31+
32+
# codecov:
33+
# runs-on: macOS-latest
34+
# needs: build
35+
# steps:
36+
# - name: Report Test Code Coverage
37+
# if: matrix.node == '12.x'
38+
# run: |
39+
# yarn global add codecov codacy-coverage
40+
# codecov
41+
# cat ./coverage/lcov.info | codacy-coverage
42+
# env:
43+
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
44+
45+
deploy:
46+
runs-on: macOS-latest
47+
needs: build
48+
steps:
49+
- name: Publish Release and npm Package
50+
if: github.event_name == 'push' && github.ref == 'master' && matrix.node == '12.x'
51+
run: bash deploy.sh
52+
env:
53+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55+
GH_BRANCH: ${{ github.ref }}
56+
GH_REPO: ${{ github.repository }}
57+
58+
codecheck:
59+
runs-on: macOS-latest
60+
needs: [build, deploy]
61+
steps:
62+
- name: Code Check
63+
if: matrix.node == '12.x'
64+
run: |
65+
yarn add -D @codechecks/client @codechecks/build-size-watcher
66+
yarn codechecks
67+
env:
68+
CC_SECRET: ${{ secrets.CC_SECRET }}

Diff for: .gitignore

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1+
.type-coverage
2+
lib
13
node_modules
2-
yarn-error.log
3-
yarn.lock
4-
.idea
5-
.vscode
4+
*.log

Diff for: .huskyrc.js

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

Diff for: .lintstagedrc.js

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

Diff for: .npmignore

-4
This file was deleted.

Diff for: .prettierrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"@1stg/prettier-config"

Diff for: .remarkrc

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"plugins": [
3+
"@1stg/remark-config"
4+
]
5+
}

Diff for: .renovaterc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "@1stg"
3+
}

Diff for: .travis.yml

-9
This file was deleted.

Diff for: CHANGELOG.md

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4+
5+
## [0.4.0](https://github.com/rx-ts/eslint-import-resolver-ts/compare/v0.3.0...v0.4.0) (2019-09-22)
6+
7+
### Bug Fixes
8+
9+
- **deps:** bump configurations, use resolutions to simplify tests ([5eb4874](https://github.com/rx-ts/eslint-import-resolver-ts/commit/5eb4874))
10+
11+
### Features
12+
13+
- replace glob with tiny-glob for faster speed, close [#12](https://github.com/rx-ts/eslint-import-resolver-ts/issues/12) ([f436627](https://github.com/rx-ts/eslint-import-resolver-ts/commit/f436627))
14+
- replace glob with tiny-glob for faster speed, close [#12](https://github.com/rx-ts/eslint-import-resolver-ts/issues/12) ([#13](https://github.com/rx-ts/eslint-import-resolver-ts/issues/13)) ([5f87698](https://github.com/rx-ts/eslint-import-resolver-ts/commit/5f87698))
15+
16+
## [0.3.0](https://github.com/rx-ts/eslint-import-resolver-ts/compare/v0.2.0...v0.3.0) (2019-09-11)

Diff for: README.md

+60-10
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,49 @@
11
# eslint-import-resolver-typescript
22

3-
[![Build Status](https://travis-ci.org/alexgorbatchev/eslint-import-resolver-typescript.svg?branch=master)](https://travis-ci.org/alexgorbatchev/eslint-import-resolver-typescript)
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)
4+
[![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)
5+
[![npm](https://img.shields.io/npm/v/eslint-import-resolver-typescript.svg)](https://www.npmjs.com/package/eslint-import-resolver-typescript)
6+
[![GitHub Release](https://img.shields.io/github/release/alexgorbatchev/eslint-import-resolver-typescript)](https://github.com/alexgorbatchev/eslint-import-resolver-typescript/releases)
47

5-
This plugin adds typescript support to [`eslint-plugin-import`](https://www.npmjs.com/package/eslint-plugin-import).
8+
[![David Peer](https://img.shields.io/david/peer/alexgorbatchev/eslint-import-resolver-typescript.svg)](https://david-dm.org/alexgorbatchev/eslint-import-resolver-typescript?type=peer)
9+
[![David](https://img.shields.io/david/alexgorbatchev/eslint-import-resolver-typescript.svg)](https://david-dm.org/alexgorbatchev/eslint-import-resolver-typescript)
10+
[![David Dev](https://img.shields.io/david/dev/alexgorbatchev/eslint-import-resolver-typescript.svg)](https://david-dm.org/alexgorbatchev/eslint-import-resolver-typescript?type=dev)
11+
12+
[![Conventional Commits](https://img.shields.io/badge/conventional%20commits-1.0.0-yellow.svg)](https://conventionalcommits.org)
13+
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
14+
[![Code Style: Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
15+
[![codechecks.io](https://raw.githubusercontent.com/codechecks/docs/master/images/badges/badge-default.svg?sanitize=true)](https://codechecks.io)
16+
17+
This plugin adds TypeScript support to [`eslint-plugin-import`](https://www.npmjs.com/package/eslint-plugin-import).
618

719
This means you can:
820

921
- `import`/`require` files with extension `.ts`/`.tsx`!
1022
- Use [`paths`](https://www.typescriptlang.org/docs/handbook/module-resolution.html#path-mapping) defined in `tsconfig.json`.
23+
- Prefer resolve `@types/*` definitions over plain `.js`.
24+
- Multiple tsconfigs support just like normal.
25+
26+
## TOC <!-- omit in toc -->
27+
28+
- [Installation](#installation)
29+
- [Configuration](#configuration)
30+
- [Contributing](#contributing)
1131

1232
## Installation
1333

14-
```bash
15-
npm install --save-dev eslint-plugin-import @typescript-eslint/parser eslint-import-resolver-typescript
34+
```sh
35+
# npm
36+
npm i -D eslint-plugin-import @typescript-eslint/parser eslint-import-resolver-typescript
37+
38+
# yarn
39+
yarn add -D eslint-plugin-import @typescript-eslint/parser eslint-import-resolver-typescript
1640
```
1741

1842
## Configuration
1943

2044
Add the following to your `.eslintrc` config:
2145

22-
```CJSON
46+
```jsonc
2347
{
2448
"plugins": ["import"],
2549
"rules": {
@@ -32,23 +56,49 @@ Add the following to your `.eslintrc` config:
3256
},
3357
"import/resolver": {
3458
// use <root>/tsconfig.json
35-
"typescript": {},
59+
"typescript": {
60+
"alwaysTryTypes": true // always try to resolve types under `<roo/>@types` directory even it doesn't contain any source code, like `@types/unist`
61+
},
3662

3763
// use <root>/path/to/folder/tsconfig.json
3864
"typescript": {
3965
"directory": "./path/to/folder"
66+
},
67+
68+
// Multiple tsconfigs (Useful for monorepos)
69+
70+
// use a glob pattern
71+
"typescript": {
72+
"directory": "./packages/*/tsconfig.json"
73+
},
74+
75+
// use an array
76+
"typescript": {
77+
"directory": [
78+
"./packages/module-a/tsconfig.json",
79+
"./packages/module-b/tsconfig.json"
80+
]
81+
},
82+
83+
// use an array of glob patterns
84+
"typescript": {
85+
"directory": [
86+
"./packages/*/tsconfig.json",
87+
"./other-packages/*/tsconfig.json"
88+
]
4089
}
4190
}
4291
}
4392
}
4493
```
4594

46-
4795
## Contributing
4896

4997
- Make sure your change is covered by a test import.
50-
- Make sure that `npm test` passes without a failure.
51-
- Make sure your code is formatted `npm format`.
98+
- Make sure that `yarn test` passes without a failure.
99+
- Make sure that `yarn lint` passes without conflicts.
100+
- Make sure your code changes match our [type-coverage](https://github.com/plantain-00/type-coverage) settings: `yarn type-coverage`.
101+
102+
We have [GitHub Actions](https://github.com/alexgorbatchev/eslint-import-resolver-typescript/actions) which will run the above commands on your PRs.
52103

53-
We have an [automatic travis build](https://travis-ci.org/alexgorbatchev/eslint-import-resolver-typescript) which will run the above on your PRs.
54104
If either fails, we won't be able to merge your PR until it's fixed.

Diff for: codechecks.yml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
checks:
2+
- name: build-size-watcher
3+
options:
4+
files:
5+
- path: 'lib/index.js'
6+
- name: type-coverage-watcher
7+
options:
8+
atLeast: 100
9+
ignoreCatch: true
10+
strict: true

Diff for: deploy.sh

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/sh
2+
3+
git remote set-url origin "https://user:$GH_TOKEN@github.com/$GH_REPO.git"
4+
npm set //registry.npmjs.org/:_authToken "$NPM_TOKEN"
5+
6+
git fetch origin "$GH_BRANCH":"$GH_BRANCH"
7+
git checkout "$GH_BRANCH"
8+
9+
PKG_VERSION=$(jq -r '.version' package.json)
10+
11+
git fetch origin v"$PKG_VERSION" || {
12+
yarn global add standard-version
13+
standard-version -a --release-as "$PKG_VERSION"
14+
git push --follow-tags origin "$GH_BRANCH"
15+
npm publish
16+
}

Diff for: dummy.js/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
module.exports = 'dummy';
1+
module.exports = 'dummy'

0 commit comments

Comments
 (0)