mirror of
https://github.com/Mastermindzh/code-style-conventions.git
synced 2024-11-21 14:22:52 +01:00
added some defaults :)
This commit is contained in:
parent
3d77415801
commit
7bc9012327
2
.dockerignore
Normal file
2
.dockerignore
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
.data
|
||||||
|
.data/**
|
24
.editorconfig
Normal file
24
.editorconfig
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
end_of_line = lf
|
||||||
|
charset = utf-8
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
insert_final_newline = true
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
charset = utf-8
|
||||||
|
|
||||||
|
[Makefile]
|
||||||
|
indent_style = tab
|
||||||
|
indent_size = 8
|
||||||
|
|
||||||
|
[{deps,tools,build}/**]
|
||||||
|
indent_style = ignore
|
||||||
|
indent_size = ignore
|
||||||
|
end_of_line = ignore
|
||||||
|
trim_trailing_whitespace = ignore
|
||||||
|
charset = ignore
|
||||||
|
|
||||||
|
[{test/fixtures,deps,build,tools/eslint,tools/gyp,tools/icu,tools/msvs}/**]
|
||||||
|
insert_final_newline = false
|
7
.eslintignore
Normal file
7
.eslintignore
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
*.scss
|
||||||
|
*.d.ts
|
||||||
|
*.spec.ts
|
||||||
|
main.browser.ts
|
||||||
|
idex.js
|
||||||
|
node_modules/*
|
||||||
|
*.e2e.*
|
62
.eslintrc
Normal file
62
.eslintrc
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
{
|
||||||
|
"env": {
|
||||||
|
"browser": true,
|
||||||
|
"jest": true,
|
||||||
|
"es6": true
|
||||||
|
},
|
||||||
|
"plugins": ["import"],
|
||||||
|
"extends": ["eslint:recommended", "prettier"],
|
||||||
|
"parserOptions": {
|
||||||
|
"ecmaVersion": 2020,
|
||||||
|
"sourceType": "module"
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
"no-console": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"allow": ["debug", "error"]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"no-eval": "error",
|
||||||
|
"import/first": "error",
|
||||||
|
"camelcase": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"ignoreImports": true,
|
||||||
|
"ignoreDestructuring": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"consistent-return": "warn",
|
||||||
|
"comma-dangle": ["warn", "always-multiline"],
|
||||||
|
"constructor-super": "error",
|
||||||
|
"curly": "error",
|
||||||
|
"eol-last": "warn",
|
||||||
|
"eqeqeq": ["error", "smart"],
|
||||||
|
"import/order": "always",
|
||||||
|
"new-parens": "error",
|
||||||
|
"no-debugger": "error",
|
||||||
|
"no-fallthrough": "off",
|
||||||
|
"max-len": [
|
||||||
|
"warn",
|
||||||
|
{
|
||||||
|
"code": 100
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"no-shadow": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"hoist": "all"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"no-trailing-spaces": "warn",
|
||||||
|
"no-underscore-dangle": "error",
|
||||||
|
"no-unsafe-finally": "error",
|
||||||
|
"no-var": "error",
|
||||||
|
"object-shorthand": "error",
|
||||||
|
"one-var": ["error", "never"],
|
||||||
|
"prefer-arrow/prefer-arrow-functions": "off",
|
||||||
|
"prefer-const": "error",
|
||||||
|
"radix": "off",
|
||||||
|
"space-in-parens": ["off", "never"]
|
||||||
|
}
|
||||||
|
}
|
39
.gitignore
vendored
Normal file
39
.gitignore
vendored
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
# Build results
|
||||||
|
[Dd]ebug/
|
||||||
|
[Dd]ebugPublic/
|
||||||
|
[Rr]elease/
|
||||||
|
[Rr]eleases/
|
||||||
|
x64/
|
||||||
|
x86/
|
||||||
|
bld/
|
||||||
|
[Bb]in/
|
||||||
|
[Oo]bj/
|
||||||
|
[Ll]og/
|
||||||
|
publish/
|
||||||
|
build/Release
|
||||||
|
coverage
|
||||||
|
lib-cov
|
||||||
|
|
||||||
|
# deps
|
||||||
|
node_modules/
|
||||||
|
__pycache__/
|
||||||
|
|
||||||
|
# Logs
|
||||||
|
logs
|
||||||
|
*.log*
|
||||||
|
|
||||||
|
# Runtime data
|
||||||
|
pids
|
||||||
|
*.pid
|
||||||
|
*.seed
|
||||||
|
|
||||||
|
# Mac files
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
# randoms
|
||||||
|
*.pyc
|
||||||
|
dbdata
|
||||||
|
old
|
||||||
|
yarn-error.log
|
||||||
|
dist
|
||||||
|
*/test-results
|
47
README.md
47
README.md
@ -1,28 +1,53 @@
|
|||||||
# @mastermindzh/prettier-config
|
# mastermindzh' code conventions
|
||||||
|
|
||||||
My preferred prettier configuration.
|
In this repo you'll find various code convention guideline files (and some .ignore stuff).
|
||||||
|
Most of my projects will use at least one of these but I strive to use as many as I can.
|
||||||
|
|
||||||
|
**note** these are by no means definitive. Every project has different needs, treat these files as a starting point.
|
||||||
|
|
||||||
<!-- toc -->
|
<!-- toc -->
|
||||||
|
|
||||||
- [Installation](#installation)
|
- [repo outline](#repo-outline)
|
||||||
- [Configuration](#configuration)
|
- [@mastermindzh/prettier-config](#mastermindzhprettier-config)
|
||||||
- [package.json](#packagejson)
|
- [Installation](#installation)
|
||||||
- [.prettierrc.js](#prettierrcjs)
|
- [Configuration](#configuration)
|
||||||
|
- [package.json](#packagejson)
|
||||||
|
- [.prettierrc.js](#prettierrcjs)
|
||||||
|
|
||||||
<!-- tocstop -->
|
<!-- tocstop -->
|
||||||
|
|
||||||
## Installation
|
## repo outline
|
||||||
|
|
||||||
|
```js
|
||||||
|
.
|
||||||
|
├── prettier // prettier config
|
||||||
|
│ ├── index.js
|
||||||
|
│ └── package.json
|
||||||
|
├── .dockerignore // things to ignore when building dockers
|
||||||
|
├── .editorconfig // default editor configuration
|
||||||
|
├── .eslintignore // files to ignore when using eslint
|
||||||
|
├── .eslintrc // default eslint config
|
||||||
|
├── .gitignore // files to ignore when working with git
|
||||||
|
├── LICENSE
|
||||||
|
└── README.md
|
||||||
|
```
|
||||||
|
|
||||||
|
## @mastermindzh/prettier-config
|
||||||
|
|
||||||
|
My preferred prettier configuration.
|
||||||
|
|
||||||
|
### Installation
|
||||||
|
|
||||||
Simply install the package with npm:
|
Simply install the package with npm:
|
||||||
|
|
||||||
`npm install --save-dev @mastermindzh/prettier-config`
|
`npm install --save-dev @mastermindzh/prettier-config`
|
||||||
|
|
||||||
## Configuration
|
### Configuration
|
||||||
|
|
||||||
Configuring your project to use `@mastermindzh/prettier-config` can be done in several ways.
|
Configuring your project to use `@mastermindzh/prettier-config` can be done in several ways.
|
||||||
The easiest is the [package.json](#packagejson) solution, the most extensible is the [.prettierrc.js](#prettierrcjs) version.
|
The easiest is the [package.json](#packagejson) solution, the most extensible is the [.prettierrc.js](#prettierrcjs) version.
|
||||||
|
|
||||||
### package.json
|
#### package.json
|
||||||
|
|
||||||
Simply add a "prettier" key with the package name:
|
Simply add a "prettier" key with the package name:
|
||||||
|
|
||||||
@ -32,7 +57,7 @@ Simply add a "prettier" key with the package name:
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### .prettierrc.js
|
#### .prettierrc.js
|
||||||
|
|
||||||
This solution requires you to put a `.prettierrc.js` file at the root of your project with the following code:
|
This solution requires you to put a `.prettierrc.js` file at the root of your project with the following code:
|
||||||
|
|
||||||
@ -40,6 +65,6 @@ This solution requires you to put a `.prettierrc.js` file at the root of your pr
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
...require("@mastermindzh/prettier-config"),
|
...require("@mastermindzh/prettier-config"),
|
||||||
// optional overrides:
|
// optional overrides:
|
||||||
jsxBracketSameLine: true
|
jsxBracketSameLine: true,
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
"patch": "npm --no-git-tag-version version patch",
|
"patch": "npm --no-git-tag-version version patch",
|
||||||
"minor": "npm --no-git-tag-version version minor",
|
"minor": "npm --no-git-tag-version version minor",
|
||||||
"major": "npm --no-git-tag-version version major",
|
"major": "npm --no-git-tag-version version major",
|
||||||
"release": "git add -A && git commit -m 'version bump and build' && git push && npm publish --access public",
|
"release": "git add -A && git commit -m 'version bump and build' && npm publish --access public && echo 'All done, don't forget to push!'",
|
||||||
"release-patch": "npm run patch && npm run release",
|
"release-patch": "npm run patch && npm run release",
|
||||||
"release-minor": "npm run minor && npm run release",
|
"release-minor": "npm run minor && npm run release",
|
||||||
"release-major": "npm run major && npm run release"
|
"release-major": "npm run major && npm run release"
|
Loading…
Reference in New Issue
Block a user