Skip to content

Commit fd16abe

Browse files
committed
Merge branch 'master' into main
2 parents 4306059 + 1e33c02 commit fd16abe

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

+8076
-0
lines changed

.eslintrc.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "@coderwyd"
3+
}

.github/workflows/release.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
with:
14+
fetch-depth: 0
15+
16+
- uses: actions/setup-node@v3
17+
with:
18+
node-version: 16.x
19+
20+
- run: npx changelogithub
21+
env:
22+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

.gitignore

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Created by .ignore support plugin (hsz.mobi)
2+
### Node template
3+
# Logs
4+
logs
5+
*.log
6+
npm-debug.log*
7+
yarn-debug.log*
8+
yarn-error.log*
9+
10+
# Runtime data
11+
pids
12+
*.pid
13+
*.seed
14+
*.pid.lock
15+
16+
# Directory for instrumented libs generated by jscoverage/JSCover
17+
lib-cov
18+
19+
# Coverage directory used by tools like istanbul
20+
coverage
21+
22+
# nyc test coverage
23+
.nyc_output
24+
25+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
26+
.grunt
27+
28+
# Bower dependency directory (https://bower.io/)
29+
bower_components
30+
31+
# node-waf configuration
32+
.lock-wscript
33+
34+
# Compiled binary addons (https://nodejs.org/api/addons.html)
35+
build/Release
36+
37+
# Dependency directories
38+
node_modules/
39+
jspm_packages/
40+
41+
# TypeScript v1 declaration files
42+
typings/
43+
44+
# Optional npm cache directory
45+
.npm
46+
47+
# Optional eslint cache
48+
.eslintcache
49+
50+
# Optional REPL history
51+
.node_repl_history
52+
53+
# Output of 'npm pack'
54+
*.tgz
55+
56+
# Yarn Integrity file
57+
.yarn-integrity
58+
59+
# dotenv environment variables file
60+
.env
61+
62+
# parcel-bundler cache (https://parceljs.org/)
63+
.cache
64+
65+
# next.js build output
66+
.next
67+
68+
# nuxt.js build output
69+
.nuxt
70+
71+
# Nuxt generate
72+
dist
73+
74+
# Serverless directories
75+
.serverless
76+
77+
# IDE
78+
.idea
79+
80+
*.lerna_backup

.npmrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
strict-peer-dependencies=false
2+
shamefully-hoist=true

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"cSpell.words": ["bumpp", "coderwyd"]
3+
}

LICENSE

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
MIT License
22

3+
<<<<<<< HEAD
34
Copyright (c) 2023 Donny Wang
5+
=======
6+
Copyright (c) 2019-PRESENT Anthony Fu<https://github.com/coderwyd>
7+
>>>>>>> master
48

59
Permission is hereby granted, free of charge, to any person obtaining a copy
610
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
# @coderwyd/eslint-config
2+
3+
- Single quotes, no semi
4+
- Auto fix for formatting (aimed to be used standalone **without** Prettier)
5+
- Designed to work with TypeScript, Vue out-of-box
6+
- Lint also for json, yaml, markdown
7+
- Sorted imports, dangling commas
8+
- Reasonable defaults, best practices, only one-line of config
9+
- **Style principle**: Minimal for reading, stable for diff
10+
11+
## Usage
12+
13+
### Install
14+
15+
```bash
16+
pnpm add -D eslint @coderwyd/eslint-config
17+
```
18+
19+
### Config `.eslintrc`
20+
21+
```json
22+
{
23+
"extends": "@coderwyd"
24+
}
25+
```
26+
27+
> You don't need `.eslintignore` normally as it has been provided by the preset.
28+
29+
### Add script for package.json
30+
31+
For example:
32+
33+
```json
34+
{
35+
"scripts": {
36+
"lint": "eslint .",
37+
"lint:fix": "eslint . --fix"
38+
}
39+
}
40+
```
41+
42+
### VS Code support (auto fix)
43+
44+
Install [VS Code ESLint extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
45+
46+
Add the following settings to your `settings.json`:
47+
48+
```jsonc
49+
{
50+
"prettier.enable": false,
51+
"editor.formatOnSave": false,
52+
"editor.codeActionsOnSave": {
53+
"source.fixAll.eslint": true,
54+
"source.organizeImports": false
55+
},
56+
57+
// The following is optional.
58+
// It's better to put under project setting `.vscode/settings.json`
59+
// to avoid conflicts with working with different eslint configs
60+
// that does not support all formats.
61+
"eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact", "vue", "html", "markdown", "json", "jsonc", "yaml"]
62+
}
63+
```
64+
65+
### TypeScript Aware Rules
66+
67+
Type aware rules are enabled when a `tsconfig.eslint.json` is found in the project root, which will introduce some stricter rules into your project. If you want to enable it while have no `tsconfig.eslint.json` in the project root, you can change tsconfig name by modifying `ESLINT_TSCONFIG` env.
68+
69+
```js
70+
// .eslintrc.js
71+
const process = require('node:process')
72+
process.env.ESLINT_TSCONFIG = 'tsconfig.json'
73+
74+
module.exports = {
75+
extends: '@coderwyd',
76+
}
77+
```
78+
79+
### Lint Staged
80+
81+
If you want to apply lint and auto-fix before every commit, you can add the following to your `package.json`:
82+
83+
```json
84+
{
85+
"simple-git-hooks": {
86+
"pre-commit": "pnpm lint-staged"
87+
},
88+
"lint-staged": {
89+
"*": "eslint --fix"
90+
}
91+
}
92+
```
93+
94+
and then
95+
96+
```bash
97+
npm i -D lint-staged simple-git-hooks
98+
```
99+
100+
## Badge
101+
102+
If you enjoy this code style, and would like to mention it in your project, here is the badge you can use:
103+
104+
## FAQ
105+
106+
### I prefer XXX...
107+
108+
Sure, you can override the rules in your `.eslintrc` file.
109+
110+
<!-- eslint-skip -->
111+
112+
```jsonc
113+
{
114+
"extends": "@coderwyd",
115+
"rules": {
116+
// your rules...
117+
}
118+
}
119+
```
120+
121+
Or you can always fork this repo and make your own.
122+
123+
## License
124+
125+
[MIT](./LICENSE) License &copy; 2019-PRESENT [Donny Wang](https://github.com/coderwyd)

package.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"name": "@coderwyd/eslint-config-monorepo",
3+
"version": "1.0.0",
4+
"private": true,
5+
"packageManager": "pnpm@8.6.7",
6+
"author": "Donny Wang <donny526@outlook.com> (https://github.com/coderwyd/)",
7+
"license": "MIT",
8+
"scripts": {
9+
"lint": "pnpm -r run stub && eslint .",
10+
"test": "pnpm -r run test",
11+
"build": "pnpm -r run build",
12+
"prepare": "pnpm -r run stub",
13+
"release": "bumpp -r && pnpm -r publish"
14+
},
15+
"devDependencies": {
16+
"@coderwyd/eslint-config": "workspace:*",
17+
"bumpp": "^9.1.1",
18+
"eslint": "^8.45.0",
19+
"eslint-plugin-coderwyd": "link:./packages/eslint-plugin-coderwyd",
20+
"rimraf": "^5.0.1",
21+
"typescript": "^5.1.6"
22+
}
23+
}

0 commit comments

Comments
 (0)