-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ feat(eslint-config): 初始化并更新ESLint配置
- 添加了ESLint的配置文件eslint.config.js,针对TypeScript和HTML文件进行了规则定义。 - 更新了angular.json中的相关配置,指定了新的ESLint配置文件路径。 - 引入了typescript-eslint库,以支持TypeScript的ESLint检查。 - 配置中强调了代码风格的一致性,如属性选择器的命名规则等。 - 此外,还整理和格式化了.prettierrc.json文件,进一步规范了代码样式。 通过这次配置的更新,项目将具备更严格的代码检查和更统一的代码风格。
- Loading branch information
Showing
4 changed files
with
54 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"tabWidth": 2, | ||
"useTabs": false, | ||
"singleQuote": true, | ||
"semi": true, | ||
"bracketSpacing": true, | ||
"arrowParens": "avoid", | ||
"trailingComma": "es5", | ||
"bracketSameLine": true, | ||
"printWidth": 80 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export default [ | ||
{ | ||
rules: { | ||
semi: 'error', | ||
'prefer-const': 'error', | ||
}, | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// @ts-check | ||
const tseslint = require('typescript-eslint'); | ||
const rootConfig = require('../../eslint.config.js'); | ||
|
||
module.exports = tseslint.config( | ||
...rootConfig, | ||
{ | ||
files: ['**/*.ts'], | ||
rules: { | ||
'@angular-eslint/directive-selector': [ | ||
'error', | ||
{ | ||
type: 'attribute', | ||
prefix: 'app', | ||
style: 'camelCase', | ||
}, | ||
], | ||
'@angular-eslint/component-selector': [ | ||
'error', | ||
{ | ||
type: 'element', | ||
prefix: 'app', | ||
style: 'kebab-case', | ||
}, | ||
], | ||
}, | ||
}, | ||
{ | ||
files: ['**/*.html'], | ||
rules: {}, | ||
} | ||
); |