Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 5240f68
Author: Anthony Fu <anthonyfu117@hotmail.com>
Date:   Tue Apr 4 08:56:34 2023 +0200

    chore: release v0.38.4

commit 79c8de5
Author: Anthony Fu <anthonyfu117@hotmail.com>
Date:   Tue Apr 4 08:56:29 2023 +0200

    chore: update deps

commit 3f13db7
Author: 曾明健 <hellozmj@qq.com>
Date:   Tue Apr 4 14:55:00 2023 +0800

    refactor: remove `eslint-plugin-node` (antfu#162)

commit 7a5daf6
Author: Anthony Fu <anthonyfu117@hotmail.com>
Date:   Mon Apr 3 17:19:24 2023 +0200

    chore: update lock

commit 79b63bc
Author: Anthony Fu <anthonyfu117@hotmail.com>
Date:   Mon Apr 3 14:43:41 2023 +0200

    chore: enable hoist

commit 60002c3
Author: Anthony Fu <anthonyfu117@hotmail.com>
Date:   Mon Apr 3 14:42:06 2023 +0200

    chore: release v0.38.3

commit 502f6b0
Author: 曾明健 <hellozmj@qq.com>
Date:   Mon Apr 3 20:41:41 2023 +0800

    feat(basic): prefer non global object of node (antfu#159)

    Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com>

commit d1cd722
Author: 曾明健 <hellozmj@qq.com>
Date:   Mon Apr 3 20:30:54 2023 +0800

    feat(basic): new line after import (antfu#161)

commit d2150ee
Author: Anthony Fu <anthonyfu117@hotmail.com>
Date:   Thu Mar 30 11:02:49 2023 +0200

    fix(top-level-function): narrow warning range

commit d3c3e1b
Author: Anthony Fu <anthonyfu117@hotmail.com>
Date:   Thu Mar 30 10:57:04 2023 +0200

    chore: update lock

commit 3963633
Author: Anthony Fu <anthonyfu117@hotmail.com>
Date:   Thu Mar 30 10:53:40 2023 +0200

    chore: release v0.38.2

commit e919334
Author: Anthony Fu <anthonyfu117@hotmail.com>
Date:   Thu Mar 30 10:53:36 2023 +0200

    chore: format

commit e8d73f7
Author: Anthony Fu <anthonyfu117@hotmail.com>
Date:   Thu Mar 30 10:51:35 2023 +0200

    chore: release v0.38.1

commit 3a74c8e
Author: Anthony Fu <anthonyfu117@hotmail.com>
Date:   Thu Mar 30 10:51:29 2023 +0200

    fix(top-level-function): support async function

commit 3fa8617
Author: Anthony Fu <anthonyfu117@hotmail.com>
Date:   Thu Mar 30 01:08:42 2023 +0200

    test: add more test case

commit ebbc1a7
Author: Anthony Fu <anthonyfu117@hotmail.com>
Date:   Wed Mar 29 15:52:45 2023 +0200

    chore: rebuild lock file

commit 417b60c
Author: Anthony Fu <anthonyfu117@hotmail.com>
Date:   Wed Mar 29 15:47:19 2023 +0200

    chore: release v0.38.0

commit 9768ccd
Author: Anthony Fu <anthonyfu117@hotmail.com>
Date:   Wed Mar 29 15:47:03 2023 +0200

    chore: update deps

commit 87d26fb
Author: Anthony Fu <anthonyfu117@hotmail.com>
Date:   Wed Mar 29 15:46:16 2023 +0200

    feat: enforce to use function declaration on top-level

commit e17d2f8
Author: Anthony Fu <anthonyfu117@hotmail.com>
Date:   Fri Mar 24 10:08:38 2023 +0100

    docs: update

commit 4ef978a
Author: Anthony Fu <anthonyfu117@hotmail.com>
Date:   Fri Mar 24 10:01:44 2023 +0100

    refactor: rename folders

commit ab850b0
Author: Anthony Fu <anthonyfu117@hotmail.com>
Date:   Sat Mar 18 22:01:51 2023 +0100

    chore: release v0.37.0

commit 7632765
Author: Anthony Fu <anthonyfu117@hotmail.com>
Date:   Sat Mar 18 22:01:39 2023 +0100

    feat: upgrade deps, support typescript 5.0

commit d3c1119
Author: Ivan Demchuk <ivan.demchuk@gmail.com>
Date:   Thu Mar 16 12:34:58 2023 +0200

    feat: enable `vue/no-unused-refs` (antfu#158)
  • Loading branch information
chrisbbreuer committed Apr 8, 2023
1 parent 2e1b5fd commit c7ed858
Show file tree
Hide file tree
Showing 21 changed files with 253 additions and 58 deletions.
1 change: 1 addition & 0 deletions .npmrc
@@ -1,3 +1,4 @@
auto-install-peers=true
ignore-workspace-root-check=true
strict-peer-dependencies=false
shamefully-hoist=true
50 changes: 47 additions & 3 deletions README.md
Expand Up @@ -11,7 +11,7 @@
Forked from [`@ow3/eslint-config`](https://github.com/antfu/eslint-config)

- Single quotes, no semi
- Auto fix for formatting (aimed to be used as standalone without Prettier)
- Auto fix for formatting (aimed to be used as standalone **without** Prettier)
- Designed to work with TypeScript, Vue out-of-box (React opt-in)
- Lint also for json, yaml, markdown
- Sorted imports, dangling commas
Expand Down Expand Up @@ -86,9 +86,53 @@ module.exports = {
}
```

## Extended Reading
### Lint Staged

Learn more about the context - [Why I don't use Prettier](https://antfu.me/posts/why-not-prettier).
If you want to apply lint and auto-fix before every commit, you can add the following to your `package.json`:

```json
{
"simple-git-hooks": {
"pre-commit": "pnpm lint-staged"
},
"lint-staged": {
"*": "eslint --fix"
}
}
```

and then

```bash
npm i -D lint-staged simple-git-hooks
```

## FAQ

### Prettier?

[Why I don't use Prettier](https://antfu.me/posts/why-not-prettier)

### How to lint CSS?

This config does NOT lint CSS. I personally use [UnoCSS](https://github.com/unocss/unocss) so I don't write CSS. If you still prefer CSS, you can use [stylelint](https://stylelint.io/) for CSS linting.

### I prefer XXX...

Sure, you can override the rules in your `.eslintrc` file.

<!-- eslint-skip -->

```jsonc
{
"extends": "@antfu",
"rules": {
// your rules...
}
}
```

Or you can always fork this repo and make your own.

## Check Also

Expand Down
42 changes: 21 additions & 21 deletions fixtures/vitesse/package.json
@@ -1,7 +1,7 @@
{
"type": "module",
"private": true,
"packageManager": "pnpm@7.21.0",
"packageManager": "pnpm@8.1.1",
"scripts": {
"build": "vite-ssg build",
"dev": "vite --port 3333 --open",
Expand All @@ -15,11 +15,11 @@
"up": "taze major -I"
},
"dependencies": {
"@unocss/reset": "^0.50.1",
"@unocss/reset": "^0.50.6",
"@vueuse/core": "^9.13.0",
"@vueuse/head": "^1.1.0",
"@vueuse/head": "^1.1.23",
"nprogress": "^0.2.0",
"pinia": "^2.0.32",
"pinia": "^2.0.33",
"vue": "^3.2.47",
"vue-demi": "^0.13.11",
"vue-i18n": "^9.2.2",
Expand All @@ -31,32 +31,32 @@
"@ow3/eslint-config": "^0.36.2",
"@types/markdown-it-link-attributes": "^3.0.1",
"@types/nprogress": "^0.2.0",
"@vitejs/plugin-vue": "^4.0.0",
"@vue/test-utils": "^2.3.0",
"@vitejs/plugin-vue": "^4.1.0",
"@vue/test-utils": "^2.3.2",
"critters": "^0.0.16",
"cross-env": "^7.0.3",
"cypress": "^12.6.0",
"eslint": "^8.34.0",
"eslint-plugin-cypress": "^2.12.1",
"cypress": "^12.9.0",
"eslint": "^8.37.0",
"eslint-plugin-cypress": "^2.13.2",
"https-localhost": "^4.7.1",
"markdown-it-link-attributes": "^4.0.1",
"markdown-it-shiki": "^0.8.0",
"pnpm": "^7.27.1",
"pnpm": "^8.1.1",
"shiki": "^0.14.1",
"taze": "^0.8.5",
"typescript": "^4.9.5",
"unocss": "^0.50.1",
"unplugin-auto-import": "^0.15.0",
"unplugin-vue-components": "^0.24.0",
"vite": "^4.1.4",
"vite-plugin-inspect": "^0.7.15",
"vite-plugin-pages": "^0.28.0",
"vite-plugin-pwa": "^0.14.4",
"taze": "^0.9.1",
"typescript": "^5.0.3",
"unocss": "^0.50.6",
"unplugin-auto-import": "^0.15.2",
"unplugin-vue-components": "^0.24.1",
"vite": "^4.2.1",
"vite-plugin-inspect": "^0.7.18",
"vite-plugin-pages": "^0.29.0",
"vite-plugin-pwa": "^0.14.7",
"vite-plugin-vue-layouts": "^0.8.0",
"vite-plugin-vue-markdown": "^0.22.4",
"vite-ssg": "^0.22.1",
"vite-ssg-sitemap": "^0.4.3",
"vitest": "^0.28.5",
"vue-tsc": "^1.1.7"
"vitest": "^0.29.8",
"vue-tsc": "^1.2.0"
}
}
2 changes: 1 addition & 1 deletion fixtures/vitesse/src/components/Footer.vue
@@ -1,7 +1,7 @@
<script setup lang="ts">
const { t, availableLocales, locale } = useI18n()
const toggleLocales = () => {
function toggleLocales() {
// change to some real logic
const locales = availableLocales
locale.value = locales[(locales.indexOf(locale.value) + 1) % locales.length]
Expand Down
2 changes: 1 addition & 1 deletion fixtures/vitesse/src/pages/index.vue
Expand Up @@ -3,7 +3,7 @@ const user = useUserStore()
const name = $ref(user.savedName)
const router = useRouter()
const go = () => {
function go() {
if (name)
router.push(`/hi/${encodeURIComponent(name)}`)
}
Expand Down
10 changes: 5 additions & 5 deletions package.json
Expand Up @@ -2,7 +2,7 @@
"name": "@ow3/eslint-config-monorepo",
"version": "0.37.2",
"private": true,
"packageManager": "pnpm@7.21.0",
"packageManager": "pnpm@8.1.1",
"author": "Chris Breuer",
"license": "MIT",
"engines": {
Expand All @@ -19,10 +19,10 @@
},
"devDependencies": {
"@ow3/eslint-config": "*",
"bumpp": "^9.0.0",
"eslint": "^8.34.0",
"bumpp": "^9.1.0",
"eslint": "^8.38.0",
"eslint-plugin-ow3": "workspace:*",
"rimraf": "^4.1.2",
"typescript": "^4.9.5"
"rimraf": "^4.4.1",
"typescript": "^5.0.3"
}
}
Expand Up @@ -223,6 +223,7 @@ module.exports = {
'import/no-mutable-exports': 'error',
'import/no-unresolved': 'off',
'import/no-absolute-path': 'off',
'import/newline-after-import': ['error', { count: 1 }],

// Common
'semi': ['error', 'never'],
Expand Down Expand Up @@ -331,6 +332,11 @@ module.exports = {
'operator-linebreak': ['error', 'before'],
'max-statements-per-line': ['error', { max: 1 }],

// node
// 'n/prefer-global/process': ['error', 'never'], // Not sure if we need it as we are using `process.env.NODE_ENV` a lot in front-end.
'n/prefer-global/buffer': ['error', 'never'],
'n/no-callback-literal': 'off',

// unicorns
// Pass error message when throwing errors
'unicorn/error-message': 'error',
Expand Down Expand Up @@ -362,7 +368,6 @@ module.exports = {
'import/no-named-as-default-member': 'off',
'import/no-named-as-default': 'off',
'import/namespace': 'off',
'n/no-callback-literal': 'off',

'sort-imports': [
'error',
Expand All @@ -382,6 +387,7 @@ module.exports = {
// ow3
'ow3/if-newline': 'error',
'ow3/import-dedupe': 'error',
'ow3/top-level-function': 'error',
// 'ow3/prefer-inline-type-import': 'error',
},
}
Expand Up @@ -22,19 +22,19 @@
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-html": "^7.1.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jsonc": "^2.6.0",
"eslint-plugin-jsonc": "^2.7.0",
"eslint-plugin-markdown": "^3.0.0",
"eslint-plugin-n": "^15.6.1",
"eslint-plugin-n": "^15.7.0",
"eslint-plugin-no-only-tests": "^3.1.0",
"eslint-plugin-ow3": "workspace:*",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-unicorn": "^45.0.2",
"eslint-plugin-unicorn": "^46.0.0",
"eslint-plugin-unused-imports": "^2.0.0",
"eslint-plugin-yml": "^1.5.0",
"jsonc-eslint-parser": "^2.1.0",
"yaml-eslint-parser": "^1.0.1"
"jsonc-eslint-parser": "^2.2.0",
"yaml-eslint-parser": "^1.2.0"
},
"devDependencies": {
"eslint": "^8.34.0"
"eslint": "^8.37.0"
}
}
File renamed without changes.
File renamed without changes.
Expand Up @@ -24,8 +24,8 @@
"eslint-plugin-react-hooks": "^4.6.0"
},
"devDependencies": {
"eslint": "^8.34.0",
"eslint": "^8.37.0",
"react": "^18.2.0",
"typescript": "^4.9.5"
"typescript": "^5.0.3"
}
}
File renamed without changes.
Expand Up @@ -18,12 +18,12 @@
},
"dependencies": {
"@ow3/eslint-config-basic": "workspace:*",
"@typescript-eslint/eslint-plugin": "^5.53.0",
"@typescript-eslint/parser": "^5.53.0",
"@typescript-eslint/eslint-plugin": "^5.57.1",
"@typescript-eslint/parser": "^5.57.1",
"eslint-plugin-jest": "^27.2.1",
"eslint-plugin-neverthrow": "^1.1.4"
},
"devDependencies": {
"eslint": "^8.34.0"
"eslint": "^8.37.0"
}
}
Expand Up @@ -68,6 +68,7 @@ module.exports = {
}],
'vue/no-restricted-v-bind': ['error', '/^v-/'],
'vue/no-useless-v-bind': 'error',
'vue/no-unused-refs': 'error',
'vue/padding-line-between-blocks': ['error', 'always'],
'vue/prefer-separate-static-class': 'error',

Expand Down
Expand Up @@ -17,10 +17,10 @@
"dependencies": {
"@ow3/eslint-config-basic": "workspace:*",
"@ow3/eslint-config-ts": "workspace:*",
"eslint-plugin-vue": "^9.9.0",
"eslint-plugin-vue": "^9.10.0",
"local-pkg": "^0.4.3"
},
"devDependencies": {
"eslint": "^8.34.0"
"eslint": "^8.37.0"
}
}
File renamed without changes.
Expand Up @@ -17,21 +17,21 @@
},
"dependencies": {
"@ow3/eslint-config-vue": "workspace:*",
"@typescript-eslint/eslint-plugin": "^5.53.0",
"@typescript-eslint/parser": "^5.53.0",
"@typescript-eslint/eslint-plugin": "^5.57.1",
"@typescript-eslint/parser": "^5.57.1",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-html": "^7.1.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jsonc": "^2.6.0",
"eslint-plugin-n": "^15.6.1",
"eslint-plugin-jsonc": "^2.7.0",
"eslint-plugin-n": "^15.7.0",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-unicorn": "^45.0.2",
"eslint-plugin-vue": "^9.9.0",
"eslint-plugin-unicorn": "^46.0.0",
"eslint-plugin-vue": "^9.10.0",
"eslint-plugin-yml": "^1.5.0",
"jsonc-eslint-parser": "^2.1.0",
"yaml-eslint-parser": "^1.0.1"
"jsonc-eslint-parser": "^2.2.0",
"yaml-eslint-parser": "^1.2.0"
},
"devDependencies": {
"eslint": "^8.34.0"
"eslint": "^8.37.0"
}
}
8 changes: 4 additions & 4 deletions packages/eslint-plugin-ow3/package.json
Expand Up @@ -16,11 +16,11 @@
"prepublishOnly": "pnpm run build"
},
"dependencies": {
"@typescript-eslint/utils": "^5.53.0"
"@typescript-eslint/utils": "^5.57.1"
},
"devDependencies": {
"@types/node": "^18.14.1",
"unbuild": "^1.1.2",
"vitest": "^0.28.5"
"@types/node": "^18.15.11",
"unbuild": "^1.2.0",
"vitest": "^0.29.8"
}
}
2 changes: 2 additions & 0 deletions packages/eslint-plugin-ow3/src/index.ts
Expand Up @@ -2,12 +2,14 @@ import genericSpacing from './rules/generic-spacing'
import ifNewline from './rules/if-newline'
import importDedupe from './rules/import-dedupe'
import preferInlineTypeImport from './rules/prefer-inline-type-import'
import topLevelFunction from './rules/top-level-function'

export default {
rules: {
'if-newline': ifNewline,
'import-dedupe': importDedupe,
'prefer-inline-type-import': preferInlineTypeImport,
'generic-spacing': genericSpacing,
'top-level-function': topLevelFunction,
},
}

0 comments on commit c7ed858

Please sign in to comment.