Skip to content
This repository was archived by the owner on Sep 14, 2023. It is now read-only.

Commit f1300b7

Browse files
authored
Implement @npm-update-package/eslint-config-typescript (#1)
* Create .nvmrc * Create LICENSE * Create .gitignore * Create package.json * Create package-lock.json * Create index.js * Create .eslintrc.js * Create release.yml * Create renovate.json * Create lint.yml * Create npm-update-package.yml * Create README.md * Update release.yml
1 parent 3212834 commit f1300b7

File tree

12 files changed

+2629
-0
lines changed

12 files changed

+2629
-0
lines changed

.eslintrc.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
extends: './index.js'
3+
}

.github/release.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
changelog:
2+
categories:
3+
- title: "Breaking changes"
4+
labels:
5+
- "breaking change"
6+
- title: "New features"
7+
labels:
8+
- "enhancement"
9+
- title: "Bug fixes"
10+
labels:
11+
- "bug"
12+
- title: "Dependency updates"
13+
labels:
14+
- "dependencies"
15+
- "npm-update-package"
16+
- "renovate"
17+
- title: "Documentation"
18+
labels:
19+
- "documentation"
20+
- title: "Other changes"
21+
labels:
22+
- "*"

.github/renovate.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"extends": [
3+
"github>npm-update-package/renovate-config"
4+
],
5+
"labels": ["renovate"],
6+
"packageRules": [
7+
{
8+
"matchManagers": ["npm"],
9+
"enabled": false
10+
}
11+
]
12+
}

.github/workflows/lint.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: lint
2+
on: [pull_request]
3+
jobs:
4+
lint:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- uses: actions/checkout@v3
8+
- uses: actions/setup-node@v3
9+
with:
10+
node-version-file: '.nvmrc'
11+
- run: npm ci
12+
- run: npm run lint
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: npm-update-package
2+
on:
3+
workflow_dispatch:
4+
schedule:
5+
- cron: '0 0 * * *'
6+
jobs:
7+
npm-update-package:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v3
11+
- uses: actions/setup-node@v3
12+
with:
13+
node-version-file: '.nvmrc'
14+
- name: Generate token
15+
id: generate_token
16+
uses: tibdex/github-app-token@v1
17+
with:
18+
app_id: ${{ secrets.APP_ID }}
19+
private_key: ${{ secrets.PRIVATE_KEY }}
20+
- run: |
21+
npx npm-update-package \
22+
--git-user-email 97396142+npm-update-package[bot]@users.noreply.github.com \
23+
--git-user-name npm-update-package[bot] \
24+
--github-token $GITHUB_TOKEN
25+
env:
26+
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}

.gitignore

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
lerna-debug.log*
8+
9+
# Diagnostic reports (https://nodejs.org/api/report.html)
10+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
11+
12+
# Runtime data
13+
pids
14+
*.pid
15+
*.seed
16+
*.pid.lock
17+
18+
# Directory for instrumented libs generated by jscoverage/JSCover
19+
lib-cov
20+
21+
# Coverage directory used by tools like istanbul
22+
coverage
23+
*.lcov
24+
25+
# nyc test coverage
26+
.nyc_output
27+
28+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
29+
.grunt
30+
31+
# Bower dependency directory (https://bower.io/)
32+
bower_components
33+
34+
# node-waf configuration
35+
.lock-wscript
36+
37+
# Compiled binary addons (https://nodejs.org/api/addons.html)
38+
build/Release
39+
40+
# Dependency directories
41+
node_modules/
42+
jspm_packages/
43+
44+
# TypeScript v1 declaration files
45+
typings/
46+
47+
# TypeScript cache
48+
*.tsbuildinfo
49+
50+
# Optional npm cache directory
51+
.npm
52+
53+
# Optional eslint cache
54+
.eslintcache
55+
56+
# Microbundle cache
57+
.rpt2_cache/
58+
.rts2_cache_cjs/
59+
.rts2_cache_es/
60+
.rts2_cache_umd/
61+
62+
# Optional REPL history
63+
.node_repl_history
64+
65+
# Output of 'npm pack'
66+
*.tgz
67+
68+
# Yarn Integrity file
69+
.yarn-integrity
70+
71+
# dotenv environment variables file
72+
.env
73+
.env.test
74+
75+
# parcel-bundler cache (https://parceljs.org/)
76+
.cache
77+
78+
# Next.js build output
79+
.next
80+
81+
# Nuxt.js build / generate output
82+
.nuxt
83+
dist
84+
85+
# Gatsby files
86+
.cache/
87+
# Comment in the public line in if your project uses Gatsby and *not* Next.js
88+
# https://nextjs.org/blog/next-9-1#public-directory-support
89+
# public
90+
91+
# vuepress build output
92+
.vuepress/dist
93+
94+
# Serverless directories
95+
.serverless/
96+
97+
# FuseBox cache
98+
.fusebox/
99+
100+
# DynamoDB Local files
101+
.dynamodb/
102+
103+
# TernJS port file
104+
.tern-port

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
14.18.3

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2022 npm-update-package
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
[![npm version](https://badge.fury.io/js/%40npm-update-package%2Feslint-config-typescript.svg)](https://badge.fury.io/js/%40npm-update-package%2Feslint-config-typescript)
2+
[![lint](https://github.com/rnpm-update-package/eslint-config-typescript/actions/workflows/lint.yml/badge.svg)](https://github.com/rnpm-update-package/eslint-config-typescript/actions/workflows/lint.yml)
3+
4+
# @npm-update-package/eslint-config-typescript
5+
6+
ESLint Shareable Config for TypeScript
7+
8+
## Peer dependencies
9+
10+
- [@eslint-recommended/eslint-config-typescript](https://www.npmjs.com/package/@eslint-recommended/eslint-config-typescript)
11+
- [@typescript-eslint/eslint-plugin](https://www.npmjs.com/package/@typescript-eslint/eslint-plugin)
12+
- [eslint](https://www.npmjs.com/package/eslint)
13+
- [eslint-config-standard-with-typescript](https://www.npmjs.com/package/eslint-config-standard-with-typescript)
14+
- [eslint-plugin-eslint-comments](https://www.npmjs.com/package/eslint-plugin-eslint-comments)
15+
- [eslint-plugin-import](https://www.npmjs.com/package/eslint-plugin-import)
16+
- [eslint-plugin-import-newlines](https://www.npmjs.com/package/eslint-plugin-impor-newlines)
17+
- [eslint-plugin-jsdoc](https://www.npmjs.com/package/eslint-plugin-jsdoc)
18+
- [eslint-plugin-n](https://www.npmjs.com/package/eslint-plugin-n)
19+
- [eslint-plugin-promise](https://www.npmjs.com/package/eslint-plugin-promise)
20+
- [eslint-plugin-tsdoc](https://www.npmjs.com/package/eslint-plugin-tsdoc)
21+
- [eslint-plugin-unicorn](https://www.npmjs.com/package/eslint-plugin-unicorn)
22+
- [typescript](https://www.npmjs.com/package/typescript)
23+
24+
## Installation
25+
26+
### npm@>=7
27+
28+
Install `@npm-update-package/eslint-config-typescript`.
29+
30+
```sh
31+
npm i -D @npm-update-package/eslint-config-typescript
32+
```
33+
34+
### npm@<7
35+
36+
Install `@npm-update-package/eslint-config-typescript` and its peer dependencies.
37+
38+
```sh
39+
npm i -D \
40+
@eslint-recommended/eslint-config-typescript \
41+
@typescript-eslint/eslint-plugin \
42+
eslint \
43+
eslint-config-standard-with-typescript \
44+
eslint-plugin-eslint-comments \
45+
eslint-plugin-import \
46+
eslint-plugin-import-newlines \
47+
eslint-plugin-jsdoc \
48+
eslint-plugin-n \
49+
eslint-plugin-promise \
50+
eslint-plugin-tsdoc \
51+
eslint-plugin-unicorn \
52+
typescript \
53+
@npm-update-package/eslint-config-typescript
54+
```
55+
56+
## Usage
57+
58+
Add `@npm-update-package/eslint-config-typescript` to `extends` of your ESLint config.
59+
60+
```json
61+
{
62+
"extends": [
63+
"@npm-update-package/eslint-config-typescript"
64+
]
65+
}
66+
```

index.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
const unicornRules = {
2+
'unicorn/error-message': 'off',
3+
'unicorn/filename-case': 'off',
4+
'unicorn/no-array-for-each': 'off',
5+
'unicorn/no-useless-undefined': 'off',
6+
'unicorn/numeric-separators-style': 'off',
7+
'unicorn/prefer-module': 'off',
8+
// TODO [engine:node@>=16]: Enable this when the minimum supported Node.js version becomes v16 or later.
9+
'unicorn/prefer-node-protocol': 'off',
10+
'unicorn/prefer-query-selector': 'off',
11+
'unicorn/prefer-spread': 'off',
12+
// TODO [engine:node@>=18]: Enable this when the minimum supported Node.js version becomes v18 or later.
13+
'unicorn/prefer-top-level-await': 'off',
14+
'unicorn/prevent-abbreviations': 'off',
15+
'unicorn/switch-case-braces': ['error', 'avoid']
16+
}
17+
18+
const importRules = {
19+
'sort-imports': 'off',
20+
'import/order': ['error', {
21+
alphabetize: {
22+
order: 'asc',
23+
caseInsensitive: true
24+
}
25+
}],
26+
'import-newlines/enforce': ['error', {
27+
items: 1,
28+
semi: false
29+
}]
30+
}
31+
32+
module.exports = {
33+
extends: [
34+
'@eslint-recommended/eslint-config-typescript'
35+
],
36+
plugins: [
37+
'import-newlines'
38+
],
39+
rules: {
40+
...unicornRules,
41+
...importRules
42+
}
43+
}

0 commit comments

Comments
 (0)