Skip to content

Commit

Permalink
Improved Resolution Handling (#9)
Browse files Browse the repository at this point in the history
* feat: 🎸 use eslint-import-resolver logic to resolve

* feat: 🎸 remove unused dependencies

Remove unused dependencies and update the release to use
release.config.js

* ci: 🎡 add linting github action

* ci: 🎡 fix actions/setup-node to use semantic version
  • Loading branch information
bradennapier authored Jul 15, 2020
1 parent 589127a commit 6a99344
Show file tree
Hide file tree
Showing 10 changed files with 423 additions and 283 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/lint_pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Lint PR Changed Files
on:
# by adding a schedule task to this workflow we will automatically
# begin serializing read-only runs and handling them. The cron job
# below is set to run every 15 minutes, GitHub will ignore anything
# under 10 minutes and run every 10 minutes anyway.
schedule:
- cron: '*/30 * * * *'
pull_request:
types:
- opened
- synchronize
- closed
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: bradennapier/eslint-plus-action@v3.4.0
with:
reportIgnoredFiles: true
reportWarningsAsErrors: true
9 changes: 5 additions & 4 deletions .github/workflows/pull_request_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ jobs:

strategy:
matrix:
node-version: [10.x, 12.x, 14.x]
node: [10.x, 12.x, 14.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v2.0.0
with:
node-version: ${{ matrix.node-version }}
node-version: ${{ matrix.node }}
check-latest: true
- name: npm install, build, and test
run: |
yarn install --pure-lockfile
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v2.0.0
with:
node-version: 12
- name: Install dependencies
Expand Down
18 changes: 6 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
- Provide import patterns that restrict imports of certain files based on location.
- Ensure imports meet the expected guidelines within your repo.
- Adapted from VSCode's rule `code-import-patterns`.
- Works with configured `paths` from your `tsconfig.json`
- Provide custom eslint messaging for each pattern if needed.
- Useful in monorepos and most Typescript projects which utilize incremental builds.

Expand All @@ -59,10 +60,6 @@
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.lint.json',
sourceType: 'module',
},
rules: {
'ts-import/patterns': [
'error',
Expand Down Expand Up @@ -95,13 +92,10 @@ module.exports = {
},
],
},
plugins: ['ts-import'],
settings: {
'import/resolver': {
typescript: {
directory: 'tsconfig.lint.json',
},
},
},
plugins: ['ts-import']
}
```

## Special Thanks

- While originally utilizing custom logic, we since borrowed the resolving method used by [eslint-import-resolver-typescript](https://github.com/alexgorbatchev/eslint-import-resolver-typescript).
51 changes: 20 additions & 31 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,40 +34,48 @@
"test": "echo Tests TODO"
},
"peerDependencies": {
"eslint": "^7.2.0",
"typescript": "^3.9.5"
"eslint": ">= 6 < 8",
"typescript": ">= 3"
},
"dependencies": {
"@zerollup/ts-helpers": "^1.7.18",
"debug": "^4.1.1",
"fast-glob": "^3.2.4",
"is-glob": "^4.0.1",
"minimatch": "^3.0.4",
"resolve": "^1.17.0",
"tsconfig-paths": "^3.9.0",
"tslib": "^2.0.0"
},
"devDependencies": {
"@semantic-release/changelog": "^5.0.1",
"@semantic-release/git": "^9.0.0",
"@semantic-release/npm": "^7.0.5",
"@types/debug": "^4.1.5",
"@types/eslint": "^7.2.0",
"@typescript-eslint/eslint-plugin": "^3.3.0",
"@typescript-eslint/parser": "^3.3.0",
"@typescript-eslint/experimental-utils": "^3.3.0",
"@types/is-glob": "^4.0.1",
"@types/minimatch": "^3.0.3",
"@types/resolve": "^1.17.1",
"@typescript-eslint/eslint-plugin": "^3.6.1",
"@typescript-eslint/experimental-utils": "^3.6.1",
"@typescript-eslint/parser": "^3.6.1",
"commitizen": "^4.1.2",
"eslint": "^7.2.0",
"eslint": "^7.4.0",
"eslint-config-airbnb-base": "^14.2.0",
"eslint-config-prettier": "^6.11.0",
"eslint-import-resolver-typescript": "^2.0.0",
"eslint-plugin-flowtype": "^5.1.3",
"eslint-plugin-import": "^2.21.2",
"eslint-plugin-flowtype": "^5.2.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-promise": "^4.2.1",
"gh-pages": "^3.0.0",
"gh-pages": "^3.1.0",
"git-cz": "^4.7.0",
"husky": "^4.2.5",
"lint-staged": "^10.2.11",
"prettier": "^2.0.5",
"rimraf": "^3.0.2",
"semantic-release": "^17.0.8",
"semantic-release": "^17.1.1",
"ts-node": "^8.10.2",
"typescript": "^3.9.5"
"typescript": "^3.9.6"
},
"files": [
"lib/",
Expand All @@ -84,25 +92,6 @@
"path": "git-cz"
}
},
"release": {
"branches": [
"master",
{
"name": "next",
"prerelease": "rc"
}
],
"verifyConditions": [
"@semantic-release/changelog",
"@semantic-release/npm",
"@semantic-release/git"
],
"prepare": [
"@semantic-release/changelog",
"@semantic-release/npm",
"@semantic-release/git"
]
},
"lint-staged": {
"src/**/*.{ts,tsx}": [
"eslint --fix"
Expand Down
26 changes: 26 additions & 0 deletions release.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
module.exports = {
plugins: [
[
'@semantic-release/commit-analyzer',
{
preset: 'conventionalcommits',
},
],
[
'@semantic-release/release-notes-generator',
{
preset: 'conventionalcommits',
},
],
'@semantic-release/npm',
[
// commits the changed files to git
'@semantic-release/git',
{
assets: ['package.json'],
},
],
// creates the github release
'@semantic-release/github',
],
};
Loading

0 comments on commit 6a99344

Please sign in to comment.