Skip to content

Instantly share code, notes, and snippets.

@mioe
Last active May 30, 2024 17:06
Show Gist options
  • Save mioe/ec863d215dbbdb044219c7ea32d65512 to your computer and use it in GitHub Desktop.
Save mioe/ec863d215dbbdb044219c7ea32d65512 to your computer and use it in GitHub Desktop.
my default rules
/**
* Required packages:
* pnpm add @eslint/js @unocss/eslint-config eslint unocss -D
*/
import js from '@eslint/js'
import pluginVue from 'eslint-plugin-vue'
import unocss from '@unocss/eslint-config/flat'
export default [
js.configs.recommended,
...pluginVue.configs['flat/recommended'],
unocss,
{
rules: {
'comma-dangle': ['error', 'always-multiline'],
'no-return-await': 'off',
'no-undef': 'off',
'no-unused-vars': ['error', { args: 'all', argsIgnorePattern: '^_' }],
'quote-props': ['error', 'as-needed'],
'space-before-function-paren': ['error', 'never'],
indent: ['error', 'tab'],
quotes: ['error', 'single'],
semi: ['error', 'never'],
// vue
'vue/block-order': ['error', { order: [ 'script', 'template', 'style' ] }],
'vue/component-api-style': ['error', ['script-setup']],
'vue/component-name-in-template-casing': ['error', 'PascalCase', { registeredComponentsOnly: false }],
'vue/custom-event-name-casing': ['error', 'kebab-case', { ignores: ['/^[a-z]+(?:-[a-z]+)*:[a-z]+(?:-[a-z]+)*$/u'] }],
'vue/define-macros-order': ['error', { order: ['defineOptions', 'defineProps', 'defineEmits', 'defineSlots'] }],
'vue/html-indent': ['error', 'tab', { attribute: 1, baseIndent: 1, closeBracket: 0, alignAttributesVertically: true, ignores: [] }],
'vue/html-self-closing': ['error', { html: { void: 'always', normal: 'any', component: 'always' }, svg: 'always', math: 'always' }],
'vue/multi-word-component-names': 'off',
'vue/next-tick-style': ['error', 'promise'],
'vue/no-empty-component-block': 'error',
'vue/no-required-prop-with-default': ['error', { autofix: false }],
'vue/padding-line-between-blocks': ['error', 'always'],
'vue/prefer-define-options': 'error',
'vue/require-default-prop': 'off',
'vue/require-macro-variable-name': ['error', { defineProps: 'props', defineEmits: 'emit', defineSlots: 'slots', useSlots: 'slots', useAttrs: 'attrs' }],
'vue/require-typed-ref': 'error',
},
},
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment