Skip to content

Commit 0231c33

Browse files
committed
Add eslint & prettier
1 parent 7ddbc4d commit 0231c33

File tree

8 files changed

+6626
-1719
lines changed

8 files changed

+6626
-1719
lines changed

.prettierignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Ignore artifacts:
2+
build
3+
coverage
4+
5+
app/frontend/routes

.prettierrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"printWidth": 80,
3+
"semi": false,
4+
"tabWidth": 2,
5+
"trailingComma": "all",
6+
"plugins": [
7+
"prettier-plugin-tailwindcss"
8+
]
9+
}

app/frontend/entrypoints/inertia.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import { createInertiaApp } from '@inertiajs/vue3'
2-
import { createApp, DefineComponent, h } from 'vue'
1+
import { createInertiaApp } from "@inertiajs/vue3"
2+
import type { DefineComponent } from "vue"
3+
import { createApp, h } from "vue"
34

45
createInertiaApp({
56
// Set default page title
@@ -13,7 +14,7 @@ createInertiaApp({
1314
// progress: false,
1415

1516
resolve: (name) => {
16-
const pages = import.meta.glob<DefineComponent>('../pages/**/*.vue', {
17+
const pages = import.meta.glob<DefineComponent>("../pages/**/*.vue", {
1718
eager: true,
1819
})
1920
return pages[`../pages/${name}.vue`]

app/frontend/pages/InertiaExample.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@
3434
</template>
3535

3636
<script setup lang="ts">
37-
import { Head } from '@inertiajs/vue3'
38-
import { ref } from 'vue'
37+
import { Head } from "@inertiajs/vue3"
38+
import { ref } from "vue"
3939
40-
import inertiaSvg from '/assets/inertia.svg'
41-
import viteRubySvg from '/assets/vite_ruby.svg'
42-
import vueSvg from '/assets/vue.svg'
40+
import inertiaSvg from "/assets/inertia.svg"
41+
import viteRubySvg from "/assets/vite_ruby.svg"
42+
import vueSvg from "/assets/vue.svg"
4343
4444
defineProps({
4545
name: String,

eslint.config.js

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import { defineConfigWithVueTs, vueTsConfigs } from '@vue/eslint-config-typescript'
2+
import pluginVue from 'eslint-plugin-vue'
3+
import skipFormatting from '@vue/eslint-config-prettier/skip-formatting'
4+
import importPlugin from "eslint-plugin-import"
5+
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: ["app/frontend/**/*.{ts,mts,tsx,vue}"]
15+
},
16+
{ ignores: ["app/frontend/routes/*"] },
17+
18+
pluginVue.configs['flat/essential'],
19+
vueTsConfigs.recommended,
20+
{
21+
...importPlugin.flatConfigs.recommended,
22+
...importPlugin.flatConfigs.typescript,
23+
rules: {
24+
"import/order": [
25+
"error",
26+
{
27+
pathGroups: [
28+
{
29+
pattern: "@/**",
30+
group: "external",
31+
position: "after",
32+
},
33+
],
34+
"newlines-between": "always",
35+
"named": true,
36+
alphabetize: { order: "asc" },
37+
},
38+
],
39+
"import/first": "error",
40+
"import/extensions": ["error", "never", { "svg": "always", "png": "always", "jpg": "always", "jpeg": "always", "gif": "always", "webp": "always" }],
41+
"@typescript-eslint/consistent-type-imports": "error",
42+
},
43+
},
44+
skipFormatting,
45+
)

0 commit comments

Comments
 (0)