From 5bc4bead766cf4abb4e347db83b898ca97657670 Mon Sep 17 00:00:00 2001 From: Sam Date: Tue, 22 Aug 2023 06:52:12 +0700 Subject: [PATCH] Add nuxt config --- packages/eslint-nuxt/README.md | 15 ++++++ packages/eslint-nuxt/index.js | 84 +++++++++++++++++++++++++++++++ packages/eslint-nuxt/package.json | 16 ++++++ 3 files changed, 115 insertions(+) create mode 100644 packages/eslint-nuxt/README.md create mode 100644 packages/eslint-nuxt/index.js create mode 100644 packages/eslint-nuxt/package.json diff --git a/packages/eslint-nuxt/README.md b/packages/eslint-nuxt/README.md new file mode 100644 index 0000000..bcc2b81 --- /dev/null +++ b/packages/eslint-nuxt/README.md @@ -0,0 +1,15 @@ +## `@snapshot-labs/eslint-config-nuxt` + +### Installation + +``` +yarn add @snapshot-labs/eslint-config-nuxt +``` + +### Usage + +``` +{ + "extends": "@snapshot-labs/nuxt" +} +``` diff --git a/packages/eslint-nuxt/index.js b/packages/eslint-nuxt/index.js new file mode 100644 index 0000000..e749947 --- /dev/null +++ b/packages/eslint-nuxt/index.js @@ -0,0 +1,84 @@ +module.exports = { + extends: ['@nuxt/eslint-config', '@snapshot-labs/eslint-config-base'], + rules: {}, + overrides: [ + { + files: ['*.vue'], + rules: { + 'vue/block-lang': [ + 'error', + { + script: { + lang: 'ts' + } + } + ], + 'vue/block-order': [ + 'error', + { + order: ['script', 'template', 'style'] + } + ], + 'vue/component-api-style': ['error', ['script-setup', 'composition']], + 'vue/component-name-in-template-casing': [ + 'error', + 'PascalCase', + { + registeredComponentsOnly: false + } + ], + 'vue/define-emits-declaration': ['error', 'type-based'], + 'vue/define-macros-order': [ + 'error', + { + order: [ + 'defineOptions', + 'defineProps', + 'defineEmits', + 'defineSlots' + ] + } + ], + 'vue/define-props-declaration': ['error', 'type-based'], + 'vue/html-button-has-type': [ + 'error', + { + button: true, + submit: true, + reset: true + } + ], + 'vue/no-required-prop-with-default': [ + 'error', + { + autofix: false + } + ], + 'vue/no-root-v-if': 'error', + 'vue/no-template-target-blank': [ + 'error', + { + allowReferrer: true, + enforceDynamicLinks: 'always' + } + ], + 'vue/no-unused-refs': 'error', + 'vue/no-v-text': 'error', + 'vue/padding-line-between-blocks': ['error', 'always'], + 'vue/prefer-define-options': 'error', + 'vue/prefer-true-attribute-shorthand': ['error', 'always'], + 'vue/require-macro-variable-name': [ + 'error', + { + defineProps: 'props', + defineEmits: 'emit', + defineSlots: 'slots', + useSlots: 'slots', + useAttrs: 'attrs' + } + ], + 'vue/v-for-delimiter-style': ['error', 'in'] + } + } + ] +}; diff --git a/packages/eslint-nuxt/package.json b/packages/eslint-nuxt/package.json new file mode 100644 index 0000000..9ba641c --- /dev/null +++ b/packages/eslint-nuxt/package.json @@ -0,0 +1,16 @@ +{ + "name": "@snapshot-labs/eslint-config-nuxt", + "version": "0.1.0-beta.9", + "publishConfig": { + "access": "public" + }, + "license": "MIT", + "main": "index.js", + "scripts": { + "lint": "eslint ." + }, + "dependencies": { + "@snapshot-labs/eslint-config-base": "^0.1.0-beta.9", + "eslint-plugin-vue": "^9.7.0" + } +}