Skip to content

Commit a8fc80b

Browse files
committed
build: add eslint + prettier support
1 parent 738c70e commit a8fc80b

File tree

9 files changed

+1042
-40
lines changed

9 files changed

+1042
-40
lines changed

Diff for: .editorconfig

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = false

Diff for: .eslintrc.js

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
module.exports = {
2+
settings: {
3+
react: {
4+
version: '16.0',
5+
},
6+
},
7+
env: {
8+
node: true,
9+
},
10+
extends: [
11+
'eslint:recommended',
12+
'plugin:vue/vue3-recommended',
13+
'airbnb',
14+
'prettier',
15+
],
16+
plugins: ['prettier'],
17+
rules: {
18+
'prettier/prettier': ['error'],
19+
'import/no-extraneous-dependencies': ['error', { devDependencies: true }],
20+
},
21+
};

Diff for: .prettierrc

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"tabWidth": 2,
3+
"useTabs": false,
4+
"printWidth": 80,
5+
"semi": true,
6+
"singleQuote": true,
7+
"quoteProps": "consistent",
8+
"trailingComma": "all",
9+
"bracketSpacing": true,
10+
"bracketSameLine": true,
11+
"arrowParens": "always",
12+
"endOfLine": "auto",
13+
"htmlWhitespaceSensitivity": "ignore"
14+
}

Diff for: package.json

+18-2
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,25 @@
77
"author": "Tim Hinz <[email protected]>",
88
"license": "MIT",
99
"private": true,
10-
"workspaces": ["packages/*"],
10+
"workspaces": [
11+
"packages/*"
12+
],
13+
"scripts": {
14+
"lint:js": "eslint --ext \".js,.vue,.ts\" --ignore-path .gitignore .",
15+
"lint:fix": "eslint --ext \".js,.vue,.ts\" --fix --ignore-path .gitignore ."
16+
},
1117
"devDependencies": {
18+
"eslint": "^8.17.0",
19+
"eslint-config-airbnb": "19.0.4",
20+
"eslint-config-prettier": "^8.5.0",
21+
"eslint-plugin-import": "^2.26.0",
22+
"eslint-plugin-jsx-a11y": "^6.5.1",
23+
"eslint-plugin-prettier": "^4.0.0",
24+
"eslint-plugin-react": "^7.28.0",
25+
"eslint-plugin-react-hooks": "^4.3.0",
26+
"eslint-plugin-vue": "^9.1.1",
1227
"lerna": "^5.1.4",
13-
"nx": "^14.3.6"
28+
"nx": "^14.3.6",
29+
"prettier": "^2.7.1"
1430
}
1531
}

Diff for: packages/app/src/App.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script setup>
22
// This starter template is using Vue 3 <script setup> SFCs
33
// Check out https://vuejs.org/api/sfc-script-setup.html#script-setup
4-
import HelloWorld from './components/HelloWorld.vue'
4+
import HelloWorld from './components/HelloWorld.vue';
55
</script>
66

77
<template>

Diff for: packages/app/src/components/HelloWorld.vue

+9-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
<script setup>
2-
import { ref } from 'vue'
2+
import { ref } from 'vue';
33
44
defineProps({
5-
msg: String
6-
})
5+
msg: {
6+
type: String,
7+
required: true,
8+
},
9+
});
710
8-
const count = ref(0)
11+
const count = ref(0);
912
</script>
1013

1114
<template>
@@ -29,7 +32,8 @@ const count = ref(0)
2932
<button type="button" @click="count++">count is: {{ count }}</button>
3033
<p>
3134
Edit
32-
<code>components/HelloWorld.vue</code> to test hot module replacement.
35+
<code>components/HelloWorld.vue</code>
36+
to test hot module replacement.
3337
</p>
3438
</template>
3539

Diff for: packages/app/src/main.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { createApp } from 'vue'
2-
import App from './App.vue'
1+
import { createApp } from 'vue';
2+
import App from './App.vue';
33

4-
createApp(App).mount('#app')
4+
createApp(App).mount('#app');

Diff for: packages/app/vite.config.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { defineConfig } from 'vite'
2-
import vue from '@vitejs/plugin-vue'
1+
import { defineConfig } from 'vite';
2+
import vue from '@vitejs/plugin-vue';
33

44
// https://vitejs.dev/config/
55
export default defineConfig({
6-
plugins: [vue()]
7-
})
6+
plugins: [vue()],
7+
});

0 commit comments

Comments
 (0)