Skip to content

Commit 678b73a

Browse files
authored
Merge pull request #11 from ackzell/#10-linting-and-formatting
#10 Adding antfu's configs and tweaking them a little.
2 parents 0ca496e + 3c98dcc commit 678b73a

File tree

17 files changed

+2195
-547
lines changed

17 files changed

+2195
-547
lines changed

.github/workflows/pipeline.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Pipeline
2+
3+
on:
4+
push:
5+
branches: [develop]
6+
pull_request:
7+
branches: [develop]
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
lint:
15+
runs-on: ubuntu-22.04
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Use Node.js from .node-version
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version-file: .node-version
22+
- name: Install pnpm
23+
uses: pnpm/action-setup@v4
24+
- name: Install dependencies
25+
run: pnpm install
26+
- name: Run linter
27+
run: pnpm lint

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Most notably, it doesn't allow for switching Vue versions nor it displays the co
1212

1313
### As part of [amoxtli-vue](https://github.com/ackzell/amoxtli-vue)
1414

15-
This is the playground that will load into a preview pane in the `amoxtli-vue` project.
15+
This is the playground that will load into a preview pane in the `amoxtli-vue` project.
1616
It reads the different [code files in the lessons](https://tutorialkit.dev/guides/creating-content/#a-lesson-code) provided from that repo and loads them into the monaco editor to interact with them.
1717

1818
![screenshot](docs/amoxtli-integration.png)

eslint.config.ts

Lines changed: 47 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,51 @@
1-
import skipFormatting from '@vue/eslint-config-prettier/skip-formatting'
2-
import { defineConfigWithVueTs, vueTsConfigs } from '@vue/eslint-config-typescript'
3-
import pluginVue from 'eslint-plugin-vue'
4-
import { globalIgnores } from 'eslint/config'
1+
import antfu from '@antfu/eslint-config';
52

6-
// To allow more languages other than `ts` in `.vue` files, uncomment the following lines:
7-
// import { configureVueProject } from '@vue/eslint-config-typescript'
8-
// configureVueProject({ scriptLangs: ['ts', 'tsx'] })
9-
// More info at https://github.com/vuejs/eslint-config-typescript/#advanced-setup
10-
11-
export default defineConfigWithVueTs(
12-
{
13-
name: 'app/files-to-lint',
14-
files: ['**/*.{ts,mts,tsx,vue}'],
3+
export default antfu({
4+
type: 'lib',
5+
stylistic: {
6+
indent: 2,
7+
quotes: 'single',
8+
semi: true,
159
},
10+
typescript: true,
11+
vue: true,
12+
jsonc: true,
13+
yaml: true,
14+
ignores: [
15+
'**/fixtures',
16+
],
17+
}, {
18+
// Additional config for more specific rules
19+
files: ['**/*.vue', '**/*.ts', '**/*.tsx', '**/*.js'],
20+
rules: {
21+
// TypeScript unused vars with underscore ignore pattern
22+
'@typescript-eslint/no-unused-vars': [
23+
'error',
24+
{
25+
argsIgnorePattern: '^_',
26+
varsIgnorePattern: '^_',
27+
},
28+
],
1629

17-
globalIgnores(['**/public/**', '**/dist/**', '**/dist-ssr/**', '**/coverage/**']),
30+
// Vue template formatting
31+
'vue/max-attributes-per-line': [
32+
'warn', // Use 'warn' instead of 'error' for less strict enforcement
33+
// {
34+
// singleline: 3,
35+
// multiline: 2,
36+
// },
37+
],
38+
'vue/first-attribute-linebreak': ['warn', {
39+
singleline: 'ignore',
40+
multiline: 'below',
41+
}],
42+
'vue/html-closing-bracket-newline': ['warn', {
43+
singleline: 'never',
44+
multiline: 'always',
45+
}],
1846

19-
pluginVue.configs['flat/essential'],
20-
vueTsConfigs.recommended,
21-
skipFormatting,
22-
)
47+
'vue/custom-event-name-casing': ['error', 'kebab-case'],
48+
'node/prefer-global/process': ['warn'],
49+
'no-console': ['warn'],
50+
},
51+
});

package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
{
2-
"name": "yehyecoa",
2+
"name": "yehyecoa-vue",
3+
"type": "module",
34
"version": "0.0.0",
45
"private": true,
5-
"type": "module",
6+
"packageManager": "[email protected]",
67
"engines": {
7-
"node": "^20.19.0 || >=22.12.0"
8+
"node": ">=24.5.0"
89
},
910
"scripts": {
1011
"dev": "vite",
1112
"build": "run-p type-check \"build-only {@}\" -- && npm run build-server",
1213
"preview": "vite preview",
1314
"build-only": "vite build",
1415
"type-check": "vue-tsc --build",
15-
"lint": "eslint . --fix",
16+
"lint": "eslint",
17+
"lint:fix": "eslint --fix",
1618
"format": "prettier --write src/",
1719
"install-in-amoxtli-vue": "cp -r dist/ ../amoxtli-vue/src/templates/yehyecoa",
1820
"bi": "npm run build && npm run install-in-amoxtli-vue",
@@ -25,6 +27,7 @@
2527
"vue": "^3.5.18"
2628
},
2729
"devDependencies": {
30+
"@antfu/eslint-config": "^5.2.1",
2831
"@tsconfig/node22": "^22.0.2",
2932
"@types/node": "^22.16.5",
3033
"@vitejs/plugin-vue": "^6.0.1",

0 commit comments

Comments
 (0)