diff --git a/packages/horizon-intl/.eslintrc.js b/packages/horizon-intl/.eslintrc.js new file mode 100644 index 00000000..3ca73b64 --- /dev/null +++ b/packages/horizon-intl/.eslintrc.js @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2020 Huawei Technologies Co.,Ltd. + * + * openGauss is licensed under Mulan PSL v2. + * You can use this software according to the terms and conditions of the Mulan PSL v2. + * You may obtain a copy of Mulan PSL v2 at: + * + * http://license.coscl.org.cn/MulanPSL2 + * + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, + * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, + * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. + * See the Mulan PSL v2 for more details. + */ + +module.exports = { + extends: [ + 'eslint:recommended', + 'plugin:@typescript-eslint/eslint-recommended', + 'plugin:@typescript-eslint/recommended', + 'prettier', + ], + root: true, + + plugins: ['jest', 'no-for-of-loops', 'no-function-declare-after-return', 'react', '@typescript-eslint'], + + parser: '@typescript-eslint/parser', + parserOptions: { + ecmaVersion: 8, + sourceType: 'module', + ecmaFeatures: { + jsx: true, + modules: true, + experimentalObjectRestSpread: true, + }, + }, + env: { + browser: true, + jest: true, + node: true, + es6: true, + }, + rules: { + '@typescript-eslint/no-explicit-any': 'off', + '@typescript-eslint/explicit-module-boundary-types': 'off', + '@typescript-eslint/no-non-null-assertion': 'off', + '@typescript-eslint/no-empty-function': 'off', + semi: ['warn', 'always'], + quotes: ['warn', 'single'], + 'accessor-pairs': 'off', + 'brace-style': ['error', '1tbs'], + 'func-style': ['warn', 'declaration', { allowArrowFunctions: true }], + 'max-lines-per-function': 'off', + 'object-curly-newline': 'off', + // 尾随逗号 + 'comma-dangle': ['error', 'only-multiline'], + + 'no-constant-condition': 'off', + 'no-for-of-loops/no-for-of-loops': 'error', + 'no-function-declare-after-return/no-function-declare-after-return': 'error', + }, + globals: { + isDev: true, + isTest: true, + }, + overrides: [ + { + files: ['scripts/tests/**/*.js'], + globals: { + container: true, + }, + }, + ], +}; diff --git a/packages/horizon-intl/.prettierrc.js b/packages/horizon-intl/.prettierrc.js new file mode 100644 index 00000000..4bf32557 --- /dev/null +++ b/packages/horizon-intl/.prettierrc.js @@ -0,0 +1,15 @@ +module.exports = { + printWidth: 120, // 一行120字符数,如果超过会进行换行 + tabWidth: 2, // tab等2个空格 + useTabs: false, // 用空格缩进行 + semi: true, // 行尾使用分号 + singleQuote: true, // 字符串使用单引号 + quoteProps: 'as-needed', // 仅在需要时在对象属性添加引号 + jsxSingleQuote: false, // 在JSX中使用双引号 + trailingComma: 'es5', // 使用尾逗号(对象、数组等) + bracketSpacing: true, // 对象的括号间增加空格 + bracketSameLine: false, // 将多行JSX元素的>放在最后一行的末尾 + arrowParens: 'avoid', // 在唯一的arrow函数参数周围省略括号 + vueIndentScriptAndStyle: false, // 不缩进Vue文件中的