Skip to content

Commit

Permalink
Set up vite/eslint/prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
gilbitron committed Feb 10, 2022
1 parent f046d91 commit 2e6c750
Show file tree
Hide file tree
Showing 7 changed files with 3,307 additions and 8 deletions.
36 changes: 36 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
module.exports = {
extends: [
'eslint:recommended',
'plugin:vue/vue3-strongly-recommended',
'prettier',
],
plugins: ['prettier'],
rules: {
indent: [
'error',
4,
{
SwitchCase: 1,
},
],
'linebreak-style': ['error', 'unix'],
quotes: [
'error',
'single',
{
avoidEscape: true,
},
],
'no-empty': [
'error',
{
allowEmptyCatch: true,
},
],
semi: 0,
'no-undef': 0,
'no-console': 0,
'vue/html-indent': ['error', 4],
'vue/max-attributes-per-line': 0,
},
};
4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"tabWidth": 4,
"singleQuote": true
}
5 changes: 4 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"recommendations": ["johnsoncodehk.volar"]
"recommendations": [
"dbaeumer.vscode-eslint",
"johnsoncodehk.volar"
]
}
10 changes: 10 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"eslint.validate": [
"javascript",
"javascriptreact",
"vue"
],
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
}
11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,18 @@
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
"preview": "vite preview",
"lint": "eslint --fix src",
},
"dependencies": {
"vue": "^3.2.25"
},
"devDependencies": {
"@vitejs/plugin-vue": "^2.2.0",
"vite": "^2.8.0"
"eslint": "^8.8.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-vue": "^8.4.1",
"vite": "^2.8.0",
}
}
}
30 changes: 26 additions & 4 deletions vite.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,29 @@
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path';
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import { fileURLToPath } from 'url';

// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()]
})
plugins: [vue()],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
},
},
build: {
lib: {
entry: path.resolve(__dirname, 'src/LaravelVuePagination.vue'),
name: 'LaravelVuePagination',
fileName: (format) => `laravel-vue-pagination.${format}.js`,
},
rollupOptions: {
external: ['vue'],
output: {
globals: {
vue: 'Vue',
},
},
},
},
});
Loading

0 comments on commit 2e6c750

Please sign in to comment.