-
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.
- Loading branch information
0 parents
commit 52521bf
Showing
16 changed files
with
7,148 additions
and
0 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 @@ | ||
node 12 |
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 @@ | ||
# top-most EditorConfig file | ||
root = true | ||
|
||
# Unix-style newlines with a newline ending every file | ||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
indent_style = space | ||
indent_size = 2 |
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 | ||
dist | ||
coverage |
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,93 @@ | ||
# ESLint at project-level as linting settings may differ between browser-based and node-based projects. | ||
# Prettier at repository-level as formatting settings will be the same across all projects. | ||
# IMPORTANT: Sync with all other '.eslintrc.yaml' files! | ||
root: true | ||
parser: "@typescript-eslint/parser" | ||
parserOptions: | ||
project: "./tsconfig.json" | ||
plugins: | ||
- "@typescript-eslint" | ||
rules: | ||
"no-else-return": error | ||
"object-shorthand": error | ||
"@typescript-eslint/no-var-requires": error | ||
"@typescript-eslint/no-redeclare": off | ||
"@typescript-eslint/member-ordering": | ||
- error | ||
- default: | ||
order: alphabetically | ||
memberTypes: | ||
# Index signature | ||
- "signature" | ||
|
||
# Fields | ||
- "public-static-field" | ||
- "protected-static-field" | ||
- "private-static-field" | ||
|
||
- "public-decorated-field" | ||
- "protected-decorated-field" | ||
- "private-decorated-field" | ||
|
||
- "public-instance-field" | ||
- "protected-instance-field" | ||
- "private-instance-field" | ||
|
||
- "public-abstract-field" | ||
- "protected-abstract-field" | ||
- "private-abstract-field" | ||
|
||
- "public-field" | ||
- "protected-field" | ||
- "private-field" | ||
|
||
- "static-field" | ||
- "instance-field" | ||
- "abstract-field" | ||
|
||
- "decorated-field" | ||
|
||
- "field" | ||
|
||
# Constructors | ||
- "public-constructor" | ||
- "protected-constructor" | ||
- "private-constructor" | ||
|
||
- "constructor" | ||
|
||
# Methods | ||
- "public-static-method" | ||
- "protected-static-method" | ||
|
||
- "public-decorated-method" | ||
- "protected-decorated-method" | ||
|
||
- "public-instance-method" | ||
- "protected-instance-method" | ||
|
||
- "public-abstract-method" | ||
- "protected-abstract-method" | ||
|
||
- "public-method" | ||
- "protected-method" | ||
|
||
- "private-static-method" | ||
- "private-decorated-method" | ||
- "private-instance-method" | ||
- "private-abstract-method" | ||
- "private-method" | ||
|
||
- "static-method" | ||
- "instance-method" | ||
- "abstract-method" | ||
|
||
- "decorated-method" | ||
|
||
- "method" | ||
extends: | ||
- standard-with-typescript | ||
- prettier | ||
- prettier/@typescript-eslint | ||
env: | ||
node: true |
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,62 @@ | ||
name: Continuous Integration | ||
|
||
on: | ||
pull_request: | ||
branches: ["*"] | ||
push: | ||
branches: ["*"] | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
ci: | ||
name: "Continuous Integration" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: "Checkout code" | ||
uses: actions/checkout@v2 | ||
- name: "Install node & npm" | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12.x | ||
- name: "Install dependencies" | ||
run: npm ci | ||
- name: "Linting" | ||
run: npm run lint | ||
- name: "Type checks" | ||
run: npm run typecheck | ||
- name: "Publish" | ||
if: github.ref == 'refs/heads/main' | ||
uses: pascalgn/npm-publish-action@1.3.5 | ||
with: | ||
tag_name: "v%s" | ||
tag_message: "v%s" | ||
commit_pattern: "^Release (\\S+)" | ||
workspace: "." | ||
publish_command: "yarn" | ||
publish_args: "--non-interactive" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Automatically generated by GitHub / is not in our secrets. | ||
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | ||
- name: "Notification on success" | ||
if: github.ref == 'refs/heads/main' | ||
uses: rtCamp/action-slack-notify@v2 | ||
env: | ||
SLACK_CHANNEL: deployments | ||
SLACK_COLOR: "#17BB5E" | ||
SLACK_TITLE: "Built: eslint-plugin-test-groups :rocket:" | ||
SLACK_FOOTER: "This package was successfully built." | ||
MSG_MINIMAL: true | ||
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | ||
- name: "Notification on failure" | ||
if: github.ref == 'refs/heads/main' && failure() | ||
uses: rtCamp/action-slack-notify@v2 | ||
env: | ||
SLACK_CHANNEL: deployments | ||
SLACK_COLOR: "#BB1717" | ||
SLACK_TITLE: "Failed: eslint-plugin-test-groups :boom:" | ||
SLACK_FOOTER: "No packages published." | ||
MSG_MINIMAL: true | ||
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} |
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,42 @@ | ||
# OSX | ||
.DS_Store | ||
.AppleDouble | ||
.LSOverride | ||
Icon | ||
._* | ||
.Spotlight-V100 | ||
.Trashes | ||
|
||
# Windows | ||
Thumbs.db | ||
ehthumbs.db | ||
Desktop.ini | ||
$RECYCLE.BIN/ | ||
*.cab | ||
*.msi | ||
*.msm | ||
*.msp | ||
|
||
# IntelliJ | ||
.idea/ | ||
*.iml | ||
|
||
# Node.js | ||
node_modules/ | ||
peer_modules/ | ||
npm-debug.log* | ||
|
||
# NPM Packages | ||
*.tgz | ||
dist/ | ||
|
||
# Serverless directories | ||
.serverless | ||
|
||
# Webpack directories | ||
.webpack | ||
|
||
# Standard | ||
tmp/ | ||
.tmp/ | ||
*.log |
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,14 @@ | ||
{ | ||
"arrowParens": "avoid", | ||
"bracketSpacing": true, | ||
"jsxBracketSameLine": true, | ||
"jsxSingleQuote": false, | ||
"printWidth": 120, | ||
"proseWrap": "preserve", | ||
"quoteProps": "consistent", | ||
"semi": true, | ||
"singleQuote": false, | ||
"tabWidth": 2, | ||
"trailingComma": "none", | ||
"useTabs": 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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2020 Upload Ltd | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,58 @@ | ||
## ESLint Rule: `require-groups-for-tests` | ||
|
||
Requires return types on lambdas that return object literals. | ||
|
||
### Installation | ||
|
||
```bash | ||
npm install --save-dev eslint-plugin-test-groups | ||
``` | ||
|
||
**.eslintrc.yaml:** | ||
|
||
```yaml | ||
root: true | ||
parser: "@typescript-eslint/parser" | ||
parserOptions: | ||
project: "./tsconfig.json" | ||
plugins: | ||
- "@typescript-eslint" | ||
- "return-types-object-literals" # ← Add this | ||
rules: | ||
# ↓ And this: | ||
"return-types-object-literals/require-groups-for-tests": error | ||
``` | ||
### Examples | ||
```typescript | ||
/** | ||
* If the 'group' attribute is not declared, then this ESLint rule will return an error. | ||
* | ||
* Furthermore, the 'group' attribute must match one the configured groups for the rule (you define these). | ||
* | ||
* @group some-test-group | ||
*/ | ||
describe("Some Tests", () => { | ||
|
||
}) | ||
``` | ||
|
||
### Benefits | ||
|
||
Ensures every test is assigned to a group. | ||
|
||
Restricting the groups to known values allows you to easily keep your CI pipelines in sync, for example, if you're running tests in parallel and need to list each group individually in your CI config. | ||
|
||
### Credits | ||
|
||
The following resources were very useful when writing this plugin: | ||
|
||
- [Writing custom TypeScript ESLint rules: How I learned to love the AST](https://dev.to/alexgomesdev/writing-custom-typescript-eslint-rules-how-i-learned-to-love-the-ast-15pn) | ||
- [AST Explorer](https://astexplorer.net/) | ||
- Set language 'JavaScript' | ||
- Set parser to '@typescript-eslint/parser' | ||
|
||
### License | ||
|
||
[MIT](LICENSE) |
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,15 @@ | ||
# Releasing | ||
|
||
To release a new version: | ||
|
||
1. `gco main` | ||
|
||
2. Set `x.y.z` into `package.json` | ||
|
||
3. `gcmsg 'Release x.y.z'` | ||
|
||
4. `gp` | ||
|
||
The CI process will automatically `git tag` and `npm publish`. | ||
|
||
(It does this by pattern-matching on `^Release (\S+)` commit messages on the `main` branch.) |
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 @@ | ||
const presets = ["@babel/preset-env"]; | ||
|
||
module.exports = { presets }; |
Oops, something went wrong.