Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Prettier for code formatting #405

Merged
merged 5 commits into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 31 additions & 55 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ module.exports = {
'plugin:@typescript-eslint/strict-type-checked',
'plugin:@typescript-eslint/stylistic-type-checked',
'plugin:unicorn/recommended',
'prettier',
],
parser: '@typescript-eslint/parser',
parserOptions: {
Expand All @@ -21,108 +22,83 @@ module.exports = {
rules: {
// Core ESLint rules
'accessor-pairs': 'error',
'array-bracket-spacing': 'error',
'arrow-parens': ['error', 'as-needed'],
'arrow-spacing': 'error',
'block-spacing': 'error',
'brace-style': ['error', 'stroustrup'],
'camelcase': ['error', {
allow: ['Vue2_6', 'Vue2_7'],
}],
'comma-dangle': ['error', 'always-multiline'],
'comma-spacing': 'error',
'comma-style': 'error',
'camelcase': [
'error',
{
allow: ['Vue2_6', 'Vue2_7'],
},
],
'consistent-return': 'error',
'curly': ['error', 'all'],
'dot-location': ['error', 'property'],
'dot-notation': 'error',
'eol-last': 'error',
'eqeqeq': 'error',
'func-call-spacing': 'error',
'getter-return': 'error',
'grouped-accessor-pairs': ['error', 'getBeforeSet'],
'guard-for-in': 'error',
'indent': 'off', // replaced by @typescript-eslint/indent
'key-spacing': 'off', // replaced by @typescript-eslint/key-spacing
'keyword-spacing': 'error',
'linebreak-style': ['error', 'unix'],
'new-parens': 'error',
'no-array-constructor': 'error',
'no-bitwise': 'error',
'no-confusing-arrow': ['error', { allowParens: true }],
'no-constant-binary-expression': 'error',
'no-constant-condition': 'error',
'no-else-return': ['error', { allowElseIf: false }],
'no-irregular-whitespace': 'error',
'no-lonely-if': 'error',
'no-loop-func': 'error',
'no-mixed-operators': 'error',
'no-multi-spaces': 'error',
'no-new-object': 'error',
'no-prototype-builtins': 'error',
'no-return-assign': 'error',
'no-return-await': 'error',
'no-shadow': 'off', // replaced by @typescript-eslint/no-shadow
'no-template-curly-in-string': 'error',
'no-trailing-spaces': 'error',
'no-unsafe-optional-chaining': ['error', { 'disallowArithmeticOperators': true }],
'object-curly-spacing': 'off', // replaced by @typescript-eslint/object-curly-spacing
'no-unsafe-optional-chaining': [
'error',
{ disallowArithmeticOperators: true },
],
'object-shorthand': ['error', 'always', { avoidQuotes: true }],
'prefer-arrow-callback': 'error',
'prefer-template': 'error',
'quotes': ['error', 'single'],
'quotes': [
'error',
'single',
{ avoidEscape: true, allowTemplateLiterals: false },
],
'radix': 'error',
'semi': 'error',
'space-before-blocks': 'error',
'space-before-function-paren': ['error', {
anonymous: 'never',
named: 'never',
asyncArrow: 'always',
}],
'space-in-parens': 'error',
'space-infix-ops': 'off', // replaced by @typescript-eslint/space-infix-ops
'spaced-comment': 'error',
'space-unary-ops': 'error',
'template-curly-spacing': 'error',

// eslint-plugin-unicorn
'unicorn/filename-case': 'off',
'unicorn/no-null': 'off',
'unicorn/no-useless-undefined': 'off', // conflicts with consistent-return
'unicorn/prevent-abbreviations': ['warn', {
replacements: {
prop: false,
'unicorn/prevent-abbreviations': [
'warn',
{
replacements: {
prop: false,
},
},
}],
],

// @typescript-eslint/eslint-plugin
'@typescript-eslint/consistent-type-exports': 'error',
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/explicit-module-boundary-types': 'error',
'@typescript-eslint/indent': ['error', 2],
'@typescript-eslint/key-spacing': 'error',
'@typescript-eslint/member-delimiter-style': 'error',
'@typescript-eslint/no-confusing-void-expression': ['error', {
ignoreVoidOperator: true,
ignoreArrowShorthand: true,
}],
'@typescript-eslint/no-confusing-void-expression': [
'error',
{
ignoreVoidOperator: true,
ignoreArrowShorthand: true,
},
],
'@typescript-eslint/no-explicit-any': 'off', // needed for Vue types compatibility
'@typescript-eslint/no-extraneous-class': 'off',
'@typescript-eslint/no-shadow': ['warn', { ignoreOnInitialization: true }],
'@typescript-eslint/object-curly-spacing': ['error', 'always'],
'@typescript-eslint/prefer-enum-initializers': 'error',
'@typescript-eslint/prefer-readonly': 'error',
'@typescript-eslint/promise-function-async': 'error',
'@typescript-eslint/sort-type-constituents': 'warn',
'@typescript-eslint/space-infix-ops': 'error',
'@typescript-eslint/switch-exhaustiveness-check': 'error',
'@typescript-eslint/type-annotation-spacing': 'error',
},
ignorePatterns: [
'**/*.json',
'node_modules',
'dist',
],
ignorePatterns: ['**/*.json', 'node_modules', 'dist'],
overrides: [
{ files: ['*.cjs'] },
{
Expand Down
24 changes: 12 additions & 12 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@

version: 2
updates:
- package-ecosystem: "npm"
versioning-strategy: "increase"
directory: "/"
- package-ecosystem: 'npm'
versioning-strategy: 'increase'
directory: '/'
schedule:
interval: "daily"
interval: 'daily'
labels:
- "dependencies"
- 'dependencies'
groups:
typescript-eslint:
patterns:
- "@typescript-eslint/*"
- '@typescript-eslint/*'
typescript:
patterns:
- "typescript"
- "@tsd/typescript"
- 'typescript'
- '@tsd/typescript'

- package-ecosystem: "github-actions"
directory: "/"
- package-ecosystem: 'github-actions'
directory: '/'
schedule:
interval: "daily"
interval: 'daily'
labels:
- "dependencies"
- 'dependencies'
6 changes: 3 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ on:
default: 'minor'
type: choice
options:
- major
- minor
- patch
- major
- minor
- patch

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
2 changes: 0 additions & 2 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
line-length: false
no-inline-html: false
ul-style:
style: sublist
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/
dist/
CHANGELOG.md
4 changes: 4 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"singleQuote": true,
"quoteProps": "consistent"
}
Loading