From 01a9747339d53e2ac67b3e6d7c5cf025eb5a7b7a Mon Sep 17 00:00:00 2001 From: joan Date: Fri, 25 Feb 2022 13:12:14 +0100 Subject: [PATCH] Updated eslint configuration --- .eslintrc.js | 56 ++++++++++++++-------------- .prettierrc.js | 6 +++ .vscode/settings.json | 9 +---- babel.config.js | 2 +- cypress.json | 4 +- jest.config.js | 8 ++-- public/index.html | 20 ++++++---- src/main.ts | 18 ++++----- src/quasar-user-options.ts | 14 +++---- src/shims-vue.d.ts | 6 +-- src/store/index.ts | 10 ++--- tsconfig.json | 76 +++++++++++++++++++------------------- vue.config.js | 19 +++++++--- 13 files changed, 128 insertions(+), 120 deletions(-) create mode 100644 .prettierrc.js diff --git a/.eslintrc.js b/.eslintrc.js index 3857599c6..a32289c8d 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,31 +1,31 @@ module.exports = { - root: true, - env: { - node: true, - }, - extends: [ - "plugin:vue/vue3-essential", - "eslint:recommended", - "@vue/typescript/recommended", - "@vue/prettier", - "@vue/prettier/@typescript-eslint", - ], - parserOptions: { - ecmaVersion: 2020, - }, - rules: { - "no-console": process.env.NODE_ENV === "production" ? "warn" : "off", - "no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off", - }, - overrides: [ - { - files: [ - "**/__tests__/*.{j,t}s?(x)", - "**/tests/unit/**/*.spec.{j,t}s?(x)", - ], - env: { - jest: true, - }, + root: true, + env: { + node: true, }, - ], + extends: [ + "plugin:vue/vue3-essential", + "eslint:recommended", + "@vue/typescript/recommended", + "@vue/prettier", + "@vue/prettier/@typescript-eslint", + ], + parserOptions: { + ecmaVersion: 2020, + }, + rules: { + "no-console": process.env.NODE_ENV === "production" ? "warn" : "off", + "no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off" + }, + overrides: [ + { + files: [ + "**/__tests__/*.{j,t}s?(x)", + "**/tests/unit/**/*.spec.{j,t}s?(x)", + ], + env: { + jest: true, + }, + }, + ], }; diff --git a/.prettierrc.js b/.prettierrc.js new file mode 100644 index 000000000..1dabc998a --- /dev/null +++ b/.prettierrc.js @@ -0,0 +1,6 @@ +module.exports = { + singleQuote: true, + printWidth: 120, + tabWidth: 4, + endOfLine: "auto", + }; \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 7a4d42166..95f0f8cbc 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,16 +1,9 @@ { - "eslint.validate": [ - "javascript", - "typescript", - "vue", - "html", - "scss", - "json", - ], "editor.codeActionsOnSave": { "source.fixAll.eslint": true, }, "editor.bracketPairColorization.enabled": true, "editor.guides.bracketPairs": true, "files.eol": "\n", + "editor.tabSize": 4, } \ No newline at end of file diff --git a/babel.config.js b/babel.config.js index 162a3ea97..218963bd8 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,3 +1,3 @@ module.exports = { - presets: ["@vue/cli-plugin-babel/preset"], + presets: ['@vue/cli-plugin-babel/preset'], }; diff --git a/cypress.json b/cypress.json index 470c72019..94d03b161 100644 --- a/cypress.json +++ b/cypress.json @@ -1,3 +1,3 @@ { - "pluginsFile": "tests/e2e/plugins/index.js" -} + "pluginsFile": "tests/e2e/plugins/index.js" +} \ No newline at end of file diff --git a/jest.config.js b/jest.config.js index 075155a2a..c2283ebfd 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,6 +1,6 @@ module.exports = { - preset: "@vue/cli-plugin-unit-jest/presets/typescript-and-babel", - transform: { - "^.+\\.vue$": "vue-jest", - }, + preset: '@vue/cli-plugin-unit-jest/presets/typescript-and-babel', + transform: { + '^.+\\.vue$': 'vue-jest', + }, }; diff --git a/public/index.html b/public/index.html index 3e5a13962..ac644cb37 100644 --- a/public/index.html +++ b/public/index.html @@ -1,17 +1,23 @@ - + + - <%= htmlWebpackPlugin.options.title %> - - + + <%= htmlWebpackPlugin.options.title %> + + + +
- - + + + \ No newline at end of file diff --git a/src/main.ts b/src/main.ts index 3f1b7d457..964223462 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,12 +1,8 @@ -import { createApp } from "vue"; -import App from "./App.vue"; -import router from "./router"; -import store from "./store"; -import { Quasar } from "quasar"; -import quasarUserOptions from "./quasar-user-options"; +import { createApp } from 'vue'; +import App from './App.vue'; +import router from './router'; +import store from './store'; +import { Quasar } from 'quasar'; +import quasarUserOptions from './quasar-user-options'; -createApp(App) - .use(Quasar, quasarUserOptions) - .use(store) - .use(router) - .mount("#app"); +createApp(App).use(Quasar, quasarUserOptions).use(store).use(router).mount('#app'); diff --git a/src/quasar-user-options.ts b/src/quasar-user-options.ts index 7b1ad0695..8ff064cd0 100644 --- a/src/quasar-user-options.ts +++ b/src/quasar-user-options.ts @@ -1,11 +1,11 @@ -import "./styles/quasar.scss"; -import lang from "quasar/lang/es.js"; -import "@quasar/extras/roboto-font/roboto-font.css"; -import "@quasar/extras/material-icons/material-icons.css"; +import './styles/quasar.scss'; +import lang from 'quasar/lang/es.js'; +import '@quasar/extras/roboto-font/roboto-font.css'; +import '@quasar/extras/material-icons/material-icons.css'; // To be used on app.use(Quasar, { ... }) export default { - config: {}, - plugins: {}, - lang: lang, + config: {}, + plugins: {}, + lang: lang, }; diff --git a/src/shims-vue.d.ts b/src/shims-vue.d.ts index 3804a43e2..07ac9503b 100644 --- a/src/shims-vue.d.ts +++ b/src/shims-vue.d.ts @@ -1,6 +1,6 @@ /* eslint-disable */ declare module '*.vue' { - import type { DefineComponent } from 'vue' - const component: DefineComponent<{}, {}, any> - export default component + import type { DefineComponent } from 'vue' + const component: DefineComponent<{}, {}, any> + export default component } diff --git a/src/store/index.ts b/src/store/index.ts index 9e1c7d3f2..ca87009ed 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -1,8 +1,8 @@ -import { createStore } from "vuex"; +import { createStore } from 'vuex'; export default createStore({ - state: {}, - mutations: {}, - actions: {}, - modules: {}, + state: {}, + mutations: {}, + actions: {}, + modules: {}, }); diff --git a/tsconfig.json b/tsconfig.json index 5c6ed5aa8..b1a50cc2f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,41 +1,41 @@ { - "compilerOptions": { - "target": "esnext", - "module": "esnext", - "strict": true, - "jsx": "preserve", - "importHelpers": true, - "moduleResolution": "node", - "experimentalDecorators": true, - "skipLibCheck": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true, - "sourceMap": true, - "baseUrl": ".", - "types": [ - "webpack-env", - "jest" - ], - "paths": { - "@/*": [ - "src/*" - ] + "compilerOptions": { + "target": "esnext", + "module": "esnext", + "strict": true, + "jsx": "preserve", + "importHelpers": true, + "moduleResolution": "node", + "experimentalDecorators": true, + "skipLibCheck": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "sourceMap": true, + "baseUrl": ".", + "types": [ + "webpack-env", + "jest" + ], + "paths": { + "@/*": [ + "src/*" + ] + }, + "lib": [ + "esnext", + "dom", + "dom.iterable", + "scripthost" + ] }, - "lib": [ - "esnext", - "dom", - "dom.iterable", - "scripthost" + "include": [ + "src/**/*.ts", + "src/**/*.tsx", + "src/**/*.vue", + "tests/**/*.ts", + "tests/**/*.tsx" + ], + "exclude": [ + "node_modules" ] - }, - "include": [ - "src/**/*.ts", - "src/**/*.tsx", - "src/**/*.vue", - "tests/**/*.ts", - "tests/**/*.tsx" - ], - "exclude": [ - "node_modules" - ] -} +} \ No newline at end of file diff --git a/vue.config.js b/vue.config.js index 39ab3136c..939447ff1 100644 --- a/vue.config.js +++ b/vue.config.js @@ -1,9 +1,16 @@ module.exports = { - pluginOptions: { - quasar: { - importStrategy: "kebab", - rtlSupport: false, + pluginOptions: { + quasar: { + importStrategy: 'kebab', + rtlSupport: false, + }, }, - }, - transpileDependencies: ["quasar"], + css: { + loaderOptions: { + sass: { + additionalData: `@import "@/styles/quasar.variables.scss";`, + }, + }, + }, + transpileDependencies: ['quasar'], };