-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
config: 🔧 新增Prettier/ESlint/StyleLint/EditorConfig代码规范
- Loading branch information
Showing
10 changed files
with
4,105 additions
and
413 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,12 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 4 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
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,3 @@ | ||
/node_modules | ||
/build | ||
/dist |
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,34 @@ | ||
module.exports = { | ||
env: { | ||
browser: true, | ||
es2021: true, | ||
node: true | ||
}, | ||
extends: ['eslint:recommended', 'plugin:react/recommended', 'plugin:@typescript-eslint/recommended'], | ||
overrides: [], | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
ecmaVersion: 'latest', | ||
sourceType: 'module' | ||
}, | ||
settings: { | ||
'import/resolver': { | ||
node: { | ||
extensions: ['.tsx', '.ts', '.js', '.json'] | ||
}, | ||
typescript: {} | ||
} | ||
}, | ||
plugins: ['react', '@typescript-eslint'], | ||
rules: { | ||
'import/extensions': [ | ||
ERROR, | ||
'ignorePackages', | ||
{ | ||
ts: 'never', | ||
tsx: 'never', | ||
js: 'never' | ||
} | ||
] | ||
} | ||
}; |
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,18 @@ | ||
module.exports = { | ||
extends: ['stylelint-config-standard', 'stylelint-config-rational-order', 'stylelint-config-prettier'], | ||
plugins: ['stylelint-order', 'stylelint-declaration-block-no-ignored-properties', 'stylelint-scss'], | ||
rules: { | ||
'plugin/declaration-block-no-ignored-properties': true, | ||
'comment-empty-line-before': null, | ||
'declaration-empty-line-before': null, | ||
'function-name-case': 'lower', | ||
'no-descending-specificity': null, | ||
'no-invalid-double-slash-comments': null, | ||
'block-no-empty': null, | ||
'value-keyword-case': null, | ||
'rule-empty-line-before': ['always', {except: ['after-single-line-comment', 'first-nested']}], | ||
'at-rule-no-unknown': null, | ||
'scss/at-rule-no-unknown': true | ||
}, | ||
ignoreFiles: ['node_modules/**/*', 'build/**/*', 'dist/**/*', 'src/assets/font/*'] | ||
}; |
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,8 +1,13 @@ | ||
import React from 'react'; | ||
import Home from '@/view/Home'; | ||
import '@/styles/index.scss'; | ||
|
||
function App() { | ||
return <div className='app'>React App</div>; | ||
return ( | ||
<div className='app'> | ||
<Home name='React App' /> | ||
</div> | ||
); | ||
} | ||
|
||
export default App; |
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 @@ | ||
## ts类型定义 |
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,17 @@ | ||
import React from 'react'; | ||
import './home.scss'; | ||
|
||
interface HomeProps { | ||
name: string; | ||
} | ||
|
||
const Home: React.FC<HomeProps> = (props) => { | ||
const {name} = props; | ||
return ( | ||
<div className='home-root'> | ||
<span className='text'>{`Hello ${name}`}</span> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Home; |
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,13 @@ | ||
.home-root { | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
width: 500px; | ||
height: 300px; | ||
font-size: 50px; | ||
background: #9ae37533; | ||
|
||
.text { | ||
color: #252525; | ||
} | ||
} |