Skip to content

Commit

Permalink
style: use prettier (element-plus#3228)
Browse files Browse the repository at this point in the history
* style: use prettier

* style: just prettier format, no code changes

* style: eslint fix
object-shorthand, prefer-const

* style: fix no-void

* style: no-console
  • Loading branch information
sxzz authored Sep 4, 2021
1 parent a414660 commit 55348b3
Show file tree
Hide file tree
Showing 823 changed files with 57,422 additions and 44,083 deletions.
88 changes: 34 additions & 54 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,72 +12,52 @@ module.exports = {
browser: true,
node: true,
},
plugins: [
'@typescript-eslint',
],
plugins: ['@typescript-eslint', 'prettier'],
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:vue/vue3-recommended',
'prettier',
],
overrides: [
{
files: ['*.ts'],
rules: {
'no-undef': 'off',
},
},
],
rules: {
// style
'block-spacing': 'error',
'eol-last': 'error',
'no-trailing-spaces': 'error',
'comma-style': ['error', 'last'],
'comma-dangle': ['error', 'always-multiline'],
'no-multi-spaces': 'error',
semi: ['error', 'never'],
'arrow-parens':['error', 'as-needed'],
'array-bracket-spacing': ['error', 'never'],

'indent': 'off',
'@typescript-eslint/indent':['error', 2, { SwitchCase: 1 }],

'object-curly-spacing': 'off',
'@typescript-eslint/object-curly-spacing': ['error', 'always'],

quotes: 'off',
'@typescript-eslint/quotes': ['error', 'single', { avoidEscape: true, allowTemplateLiterals: true }],

'space-infix-ops': 'off',
'@typescript-eslint/space-infix-ops': ['error', { 'int32Hint': false }],

'@typescript-eslint/type-annotation-spacing': ['error', {}],

// js/ts
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': 'warn',
'no-redeclare': 'off',
'@typescript-eslint/no-redeclare': 'error',
'no-console': ['warn', { allow: ['warn', 'error'] }],
'no-restricted-syntax': ['error', 'LabeledStatement', 'WithStatement'],
camelcase: ['error', { properties: 'never' }],
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/member-delimiter-style': [

'no-var': 'error',
'prefer-const': [
'warn',
{ destructuring: 'all', ignoreReadBeforeAssign: true },
],
'object-shorthand': [
'error',
{
multiline: {
delimiter: 'none',
requireLast: false,
},
singleline: {
delimiter: 'semi',
requireLast: true,
},
},
'always',
{ ignoreConstructors: false, avoidQuotes: true },
],
'block-scoped-var': 'error',
complexity: ['off', 11],
'no-with': 'error',
'no-void': 'error',

'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',

// vue
'vue/no-v-html': 'off',
'vue/singleline-html-element-content-newline': 'off',
'vue/html-self-closing': ['error', {
html: {
void: 'never',
normal: 'never',
component: 'always',
},
}],
'vue/max-attributes-per-line': ['error', {
singleline: 3,
multiline: 1,
}],
'vue/require-default-prop': 'off',
'vue/html-closing-bracket-spacing': 'error',

'prettier/prettier': 'warn',
},
}
1 change: 0 additions & 1 deletion .github/CONTRIBUTING.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,3 @@ We are excited that you are interested in contributing to Element Plus. Before s
- If your PR fixes a bug, please provide a description about the related bug.

- Merging a PR takes two maintainers: one approves the changes after reviewing, and then the other reviews and merges.

7 changes: 2 additions & 5 deletions .github/CONTRIBUTING.es.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,14 @@

Estamos orgullosos de que usted esta interesado en contribuir al proyecto `Element Plus`. Antes de someter sus contribuciones, por favor tome un momentito para leer estas simples guías para contribuidores.


## Guía Para Reportar Problemas (“Issues”)

- Preguntas de otro tipo corren el riesgo de ser cerradas inmediatamente. Sí tiene preguntas sobre el uso de `Element`, vea [Discord](https://discord.link/ElementPlus) para más ayuda.

- Antes de someter un informe sobre algún problema, sírvase de revisar sí ya hubo un informe.
- Antes de someter un informe sobre algún problema, sírvase de revisar sí ya hubo un informe.

- Por favor especifique que versión de `Element Plus` y `Vue` que esta utilizando, y que versión de sistema operativo y que versión de navegador web que está utilizando. [JSFiddle](https://jsfiddle.net/) esta recomendado para crear un entorno para reproducir el problema claramente.


## Guías para un “Pull Request (PR)”

- Crea una bifurcación (“fork”) del repositorio a su propia cuenta en github.com. Por favor no crea ramas nuevas aquí.
Expand All @@ -28,9 +26,8 @@ Estamos orgullosos de que usted esta interesado en contribuir al proyecto `Eleme

- “Rebase” antes de crear un “pull request (PR)” para mantener la historia de “commits” limpia.

- Asegúrese que sus PRs se refrieran a la rama `dev` y no a la rama `master`.
- Asegúrese que sus PRs se refrieran a la rama `dev` y no a la rama `master`.

- Si su PR arregla un error técnico, por favor, haga referencia al error especifico.

- Fusión de un PR requiere dos mantenedores: el primero aprueba los cambios después de revisar, y entonces el segundo mantenedor revisa los cambios y hace la fusión.

1 change: 0 additions & 1 deletion .github/CONTRIBUTING.fr-FR.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,3 @@ Nous sommes ravis que vous souhaitiez contribuer à Element Plus. Avant de soume
- Si votre PR corrige un bug, veuillez fournir une description du bug en question.

- La fusion d'un PR nécessite deux responsables: l'un approuve les modifications après révision, puis l'autre les révise et les fusionne.

2 changes: 2 additions & 0 deletions .github/CONTRIBUTING.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ Element Plus 是一套为开发者、设计师和产品经理准备的开源组
Element Plus 的成长离不开大家的支持,如果你愿意为 Element Plus 贡献代码或提供建议,请阅读以下内容。

## Issue 规范

- issue 仅用于提交 Bug 或 Feature 以及设计相关的内容,其它内容可能会被直接关闭。如果你在使用时产生了疑问,请到 Slack 或 [Discord](https://discord.link/ElementPlus) 里咨询。

- 在提交 issue 之前,请搜索相关内容是否已被提出。

- 请说明 Element Plus 和 Vue 的版本号,并提供操作系统和浏览器信息。推荐使用 [JSFiddle](https://jsfiddle.net/) 生成在线 demo,这能够更直观地重现问题。

## Pull Request 规范

- 请先 fork 一份到自己的项目下,不要直接在仓库下建分支。

- commit 信息要以`[组件名]: 描述信息` 的形式填写,例如 `Button: fix xxx bug`
Expand Down
6 changes: 3 additions & 3 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Please make sure these boxes are checked before submitting your PR, thank you!

* [ ] Make sure you follow Element's contributing guide [English](https://github.com/element-plus/element-plus/blob/master/.github/CONTRIBUTING.en-US.md) | ([中文](https://github.com/element-plus/element-plus/blob/master/.github/CONTRIBUTING.zh-CN.md) | [Español](https://github.com/element-plus/element-plus/blob/master/.github/CONTRIBUTING.es.md) | [Français](https://github.com/element-plus/element-plus/blob/master/.github/CONTRIBUTING.fr-FR.md)).
* [ ] Make sure you are merging your commits to `dev` branch.
* [ ] Add some descriptions and refer to relative issues for your PR.
- [ ] Make sure you follow Element's contributing guide [English](https://github.com/element-plus/element-plus/blob/master/.github/CONTRIBUTING.en-US.md) | ([中文](https://github.com/element-plus/element-plus/blob/master/.github/CONTRIBUTING.zh-CN.md) | [Español](https://github.com/element-plus/element-plus/blob/master/.github/CONTRIBUTING.es.md) | [Français](https://github.com/element-plus/element-plus/blob/master/.github/CONTRIBUTING.fr-FR.md)).
- [ ] Make sure you are merging your commits to `dev` branch.
- [ ] Add some descriptions and refer to relative issues for your PR.
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
dist
node_modules
packages/*/es
packages/*/lib
8 changes: 8 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"printWidth": 80,
"tabWidth": 2,
"semi": false,
"singleQuote": true,
"endOfLine": "lf",
"trailingComma": "es5"
}
16 changes: 0 additions & 16 deletions .prettierrc.js

This file was deleted.

Loading

0 comments on commit 55348b3

Please sign in to comment.