eslint-plugin-jest-formatting 3.0.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +110 -0
- package/CHANGELOG.md +33 -0
- package/README.md +44 -1
- package/docs/rules/padding-around-after-all-blocks.md +73 -11
- package/docs/rules/padding-around-after-each-blocks.md +67 -11
- package/docs/rules/padding-around-all.md +102 -9
- package/docs/rules/padding-around-before-all-blocks.md +67 -13
- package/docs/rules/padding-around-before-each-blocks.md +65 -11
- package/docs/rules/padding-around-describe-blocks.md +64 -5
- package/docs/rules/padding-around-expect-groups.md +64 -6
- package/docs/rules/padding-around-test-blocks.md +76 -13
- package/lib/ast-utils.js +15 -8
- package/lib/index.js +84 -54
- package/lib/rules/padding.js +47 -21
- package/llms.txt +29 -0
- package/package.json +28 -21
- package/.circleci/config.yml +0 -67
- package/.eslintignore +0 -3
- package/.eslintrc +0 -34
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -31
- package/.github/ISSUE_TEMPLATE/rule-request.md +0 -21
- package/.prettierignore +0 -4
- package/.prettierrc +0 -4
- package/docs/rules/padding-before-after-all-blocks.md +0 -24
- package/docs/rules/padding-before-after-each-blocks.md +0 -24
- package/docs/rules/padding-before-all.md +0 -15
- package/docs/rules/padding-before-before-all-blocks.md +0 -24
- package/docs/rules/padding-before-before-each-blocks.md +0 -24
- package/docs/rules/padding-before-describe-blocks.md +0 -28
- package/docs/rules/padding-before-expect-statements.md +0 -22
- package/docs/rules/padding-before-test-blocks.md +0 -31
- package/jest.config.js +0 -4
- package/renovate.json +0 -3
- package/src/ast-utils.ts +0 -80
- package/src/index.ts +0 -182
- package/src/rules/padding.ts +0 -357
- package/tests/catfood.js +0 -41
- package/tests/dogfood.spec.js +0 -32
- package/tests/lib/ast-utils.spec.ts +0 -94
- package/tests/lib/rules/padding-around-after-all-blocks.spec.js +0 -115
- package/tests/lib/rules/padding-around-after-each-blocks.spec.js +0 -113
- package/tests/lib/rules/padding-around-before-all-blocks.spec.js +0 -115
- package/tests/lib/rules/padding-around-before-each-blocks.spec.js +0 -115
- package/tests/lib/rules/padding-around-describe-blocks.spec.js +0 -153
- package/tests/lib/rules/padding-around-expect-groups.spec.js +0 -217
- package/tests/lib/rules/padding-around-test-blocks.spec.js +0 -162
- package/tsconfig.json +0 -12
package/lib/rules/padding.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createRule = exports.PaddingType = exports.StatementType = void 0;
|
|
3
|
+
exports.createRule = exports.DOCS_BASE_URL = exports.messages = exports.getStatementToken = exports.PaddingType = exports.StatementType = void 0;
|
|
4
4
|
const astUtils = require("../ast-utils");
|
|
5
5
|
var StatementType;
|
|
6
6
|
(function (StatementType) {
|
|
@@ -24,19 +24,29 @@ var PaddingType;
|
|
|
24
24
|
PaddingType[PaddingType["Any"] = 0] = "Any";
|
|
25
25
|
PaddingType[PaddingType["Always"] = 1] = "Always";
|
|
26
26
|
})(PaddingType = exports.PaddingType || (exports.PaddingType = {}));
|
|
27
|
+
const getStatementToken = (node, sourceCode) => {
|
|
28
|
+
let activeNode = node;
|
|
29
|
+
while (activeNode.type === 'LabeledStatement') {
|
|
30
|
+
activeNode = activeNode.body;
|
|
31
|
+
}
|
|
32
|
+
if (activeNode.type === 'ExpressionStatement') {
|
|
33
|
+
const expression = activeNode.expression.type === 'AwaitExpression'
|
|
34
|
+
? activeNode.expression.argument
|
|
35
|
+
: activeNode;
|
|
36
|
+
const token = sourceCode.getFirstToken(expression);
|
|
37
|
+
return token.type === 'Identifier' ? token.value : null;
|
|
38
|
+
}
|
|
39
|
+
return null;
|
|
40
|
+
};
|
|
41
|
+
exports.getStatementToken = getStatementToken;
|
|
27
42
|
const createTokenTester = (tokenName) => {
|
|
28
|
-
return (node, sourceCode) =>
|
|
29
|
-
let activeNode = node;
|
|
30
|
-
if (activeNode.type === 'ExpressionStatement') {
|
|
31
|
-
if (activeNode.expression.type === 'AwaitExpression') {
|
|
32
|
-
activeNode = activeNode.expression.argument;
|
|
33
|
-
}
|
|
34
|
-
const token = sourceCode.getFirstToken(activeNode);
|
|
35
|
-
return token.type === 'Identifier' && token.value === tokenName;
|
|
36
|
-
}
|
|
37
|
-
return false;
|
|
38
|
-
};
|
|
43
|
+
return (node, sourceCode) => (0, exports.getStatementToken)(node, sourceCode) === tokenName;
|
|
39
44
|
};
|
|
45
|
+
exports.messages = {
|
|
46
|
+
missingPaddingBefore: 'Missing blank line before `{{token}}`. Expected at least one blank line between the previous statement and this `{{token}}` call. Fix: insert an empty line between the statements, before any comments leading the next statement (autofixable with --fix).',
|
|
47
|
+
missingPaddingAfter: 'Missing blank line after `{{token}}`. Expected at least one blank line between the `{{token}}` call above and this statement. Fix: insert an empty line between the statements, before any comments leading the next statement (autofixable with --fix).',
|
|
48
|
+
};
|
|
49
|
+
exports.DOCS_BASE_URL = 'https://github.com/dangreenisrael/eslint-plugin-jest-formatting/blob/master/docs/rules';
|
|
40
50
|
const statementTesters = {
|
|
41
51
|
[0]: () => true,
|
|
42
52
|
[1]: createTokenTester('afterAll'),
|
|
@@ -53,18 +63,23 @@ const statementTesters = {
|
|
|
53
63
|
[12]: createTokenTester('xit'),
|
|
54
64
|
[13]: createTokenTester('xtest'),
|
|
55
65
|
};
|
|
56
|
-
const paddingAlwaysTester = (prevNode, nextNode, paddingContext) => {
|
|
66
|
+
const paddingAlwaysTester = (prevNode, nextNode, paddingContext, config) => {
|
|
57
67
|
const { sourceCode, ruleContext } = paddingContext;
|
|
58
68
|
const paddingLines = astUtils.getPaddingLineSequences(prevNode, nextNode, sourceCode);
|
|
59
69
|
if (paddingLines.length > 0) {
|
|
60
70
|
return;
|
|
61
71
|
}
|
|
72
|
+
const nextIsJestCall = config !== undefined && config.nextStatementType !== 0;
|
|
73
|
+
const tokenNode = nextIsJestCall ? nextNode : prevNode;
|
|
62
74
|
ruleContext.report({
|
|
63
75
|
node: nextNode,
|
|
64
|
-
|
|
76
|
+
messageId: nextIsJestCall ? 'missingPaddingBefore' : 'missingPaddingAfter',
|
|
77
|
+
data: {
|
|
78
|
+
token: (0, exports.getStatementToken)(tokenNode, sourceCode) || 'statement',
|
|
79
|
+
},
|
|
65
80
|
fix(fixer) {
|
|
66
81
|
let prevToken = astUtils.getActualLastToken(sourceCode, prevNode);
|
|
67
|
-
const nextToken = sourceCode.getFirstTokenBetween(prevToken, nextNode, {
|
|
82
|
+
const nextToken = (sourceCode.getFirstTokenBetween(prevToken, nextNode, {
|
|
68
83
|
includeComments: true,
|
|
69
84
|
filter(token) {
|
|
70
85
|
if (astUtils.areTokensOnSameLine(prevToken, token)) {
|
|
@@ -73,7 +88,7 @@ const paddingAlwaysTester = (prevNode, nextNode, paddingContext) => {
|
|
|
73
88
|
}
|
|
74
89
|
return true;
|
|
75
90
|
},
|
|
76
|
-
}) || nextNode;
|
|
91
|
+
}) || nextNode);
|
|
77
92
|
const insertText = astUtils.areTokensOnSameLine(prevToken, nextToken)
|
|
78
93
|
? '\n\n'
|
|
79
94
|
: '\n';
|
|
@@ -117,12 +132,13 @@ const nodeMatchesType = (node, statementType, paddingContext) => {
|
|
|
117
132
|
};
|
|
118
133
|
const testPadding = (prevNode, nextNode, paddingContext) => {
|
|
119
134
|
const { configs } = paddingContext;
|
|
120
|
-
const testType = (type) => paddingTesters[type](prevNode, nextNode, paddingContext);
|
|
135
|
+
const testType = (type, config) => paddingTesters[type](prevNode, nextNode, paddingContext, config);
|
|
121
136
|
for (let i = configs.length - 1; i >= 0; --i) {
|
|
122
|
-
const
|
|
137
|
+
const config = configs[i];
|
|
138
|
+
const { prevStatementType: prevType, nextStatementType: nextType, paddingType, } = config;
|
|
123
139
|
if (nodeMatchesType(prevNode, prevType, paddingContext) &&
|
|
124
140
|
nodeMatchesType(nextNode, nextType, paddingContext)) {
|
|
125
|
-
return testType(paddingType);
|
|
141
|
+
return testType(paddingType, config);
|
|
126
142
|
}
|
|
127
143
|
}
|
|
128
144
|
return testType(0);
|
|
@@ -137,15 +153,24 @@ const verifyNode = (node, paddingContext) => {
|
|
|
137
153
|
}
|
|
138
154
|
scopeInfo.prevNode = node;
|
|
139
155
|
};
|
|
140
|
-
|
|
156
|
+
const createRule = ({ name, description, configs, deprecated = false, }) => ({
|
|
141
157
|
meta: {
|
|
158
|
+
type: 'layout',
|
|
159
|
+
docs: {
|
|
160
|
+
description,
|
|
161
|
+
url: `${exports.DOCS_BASE_URL}/${name}.md`,
|
|
162
|
+
},
|
|
142
163
|
fixable: 'whitespace',
|
|
164
|
+
messages: exports.messages,
|
|
165
|
+
schema: [],
|
|
143
166
|
deprecated,
|
|
144
167
|
},
|
|
145
168
|
create(context) {
|
|
169
|
+
const sourceCode = context.sourceCode ||
|
|
170
|
+
context.getSourceCode();
|
|
146
171
|
const paddingContext = {
|
|
147
172
|
ruleContext: context,
|
|
148
|
-
sourceCode
|
|
173
|
+
sourceCode,
|
|
149
174
|
scopeInfo: createScopeInfo(),
|
|
150
175
|
configs,
|
|
151
176
|
};
|
|
@@ -166,3 +191,4 @@ exports.createRule = (configs, deprecated = false) => ({
|
|
|
166
191
|
};
|
|
167
192
|
},
|
|
168
193
|
});
|
|
194
|
+
exports.createRule = createRule;
|
package/llms.txt
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# eslint-plugin-jest-formatting
|
|
2
|
+
|
|
3
|
+
> ESLint rules that require a blank line before and after Jest blocks: `describe`, `test`/`it`, `beforeAll`, `beforeEach`, `afterAll`, `afterEach`, and groups of `expect` statements. Every rule is autofixable with `eslint --fix`, takes no options, and reports a message that states the problem and the fix. Works with ESLint 8, 9, and 10 in flat config and legacy `.eslintrc`.
|
|
4
|
+
|
|
5
|
+
Install with `npm install --save-dev eslint-plugin-jest-formatting`. Enable `jestFormatting.configs['flat/recommended']` in `eslint.config.js`, or `"extends": ["plugin:jest-formatting/recommended"]` in `.eslintrc`. The `strict` variants enable `padding-around-all`, which also pads `expect` groups.
|
|
6
|
+
|
|
7
|
+
## Start here
|
|
8
|
+
|
|
9
|
+
- [AGENTS.md](https://raw.githubusercontent.com/dangreenisrael/eslint-plugin-jest-formatting/master/AGENTS.md): one-page briefing: purpose, every rule in one line, flat and legacy config snippets, how to build and test
|
|
10
|
+
- [README](https://raw.githubusercontent.com/dangreenisrael/eslint-plugin-jest-formatting/master/README.md): installation and configuration
|
|
11
|
+
|
|
12
|
+
## Rules
|
|
13
|
+
|
|
14
|
+
Each page has the same sections in the same order: Rule summary, Why, Incorrect examples, Correct examples, Options, Fixability.
|
|
15
|
+
|
|
16
|
+
- [padding-around-after-all-blocks](https://raw.githubusercontent.com/dangreenisrael/eslint-plugin-jest-formatting/master/docs/rules/padding-around-after-all-blocks.md): blank line before and after each `afterAll` call
|
|
17
|
+
- [padding-around-after-each-blocks](https://raw.githubusercontent.com/dangreenisrael/eslint-plugin-jest-formatting/master/docs/rules/padding-around-after-each-blocks.md): blank line before and after each `afterEach` call
|
|
18
|
+
- [padding-around-before-all-blocks](https://raw.githubusercontent.com/dangreenisrael/eslint-plugin-jest-formatting/master/docs/rules/padding-around-before-all-blocks.md): blank line before and after each `beforeAll` call
|
|
19
|
+
- [padding-around-before-each-blocks](https://raw.githubusercontent.com/dangreenisrael/eslint-plugin-jest-formatting/master/docs/rules/padding-around-before-each-blocks.md): blank line before and after each `beforeEach` call
|
|
20
|
+
- [padding-around-describe-blocks](https://raw.githubusercontent.com/dangreenisrael/eslint-plugin-jest-formatting/master/docs/rules/padding-around-describe-blocks.md): blank line before and after each `describe`, `fdescribe`, or `xdescribe` block
|
|
21
|
+
- [padding-around-expect-groups](https://raw.githubusercontent.com/dangreenisrael/eslint-plugin-jest-formatting/master/docs/rules/padding-around-expect-groups.md): blank line before and after each run of consecutive `expect` statements, not between them
|
|
22
|
+
- [padding-around-test-blocks](https://raw.githubusercontent.com/dangreenisrael/eslint-plugin-jest-formatting/master/docs/rules/padding-around-test-blocks.md): blank line before and after each `test`, `it`, `fit`, `xit`, or `xtest` block
|
|
23
|
+
- [padding-around-all](https://raw.githubusercontent.com/dangreenisrael/eslint-plugin-jest-formatting/master/docs/rules/padding-around-all.md): all of the above as a single rule; used by the `strict` configs
|
|
24
|
+
|
|
25
|
+
## Optional
|
|
26
|
+
|
|
27
|
+
- [CHANGELOG](https://raw.githubusercontent.com/dangreenisrael/eslint-plugin-jest-formatting/master/CHANGELOG.md): release history
|
|
28
|
+
- [Source repository](https://github.com/dangreenisrael/eslint-plugin-jest-formatting): issues and pull requests
|
|
29
|
+
- [npm package](https://www.npmjs.com/package/eslint-plugin-jest-formatting): published releases
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-jest-formatting",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "ESLint rules for formatting jest tests",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -14,42 +14,49 @@
|
|
|
14
14
|
"author": "Dan Green-Leipciger",
|
|
15
15
|
"repository": {
|
|
16
16
|
"type": "git",
|
|
17
|
-
"url": "https://github.com/dangreenisrael/eslint-plugin-jest-formatting"
|
|
17
|
+
"url": "git+https://github.com/dangreenisrael/eslint-plugin-jest-formatting.git"
|
|
18
18
|
},
|
|
19
19
|
"main": "lib/index.js",
|
|
20
|
-
"
|
|
20
|
+
"files": [
|
|
21
|
+
"lib",
|
|
22
|
+
"docs",
|
|
23
|
+
"AGENTS.md",
|
|
24
|
+
"llms.txt",
|
|
25
|
+
"CHANGELOG.md"
|
|
26
|
+
],
|
|
21
27
|
"scripts": {
|
|
22
28
|
"pretty": "yarn prettier '**/*.*'",
|
|
23
29
|
"lint": "yarn build && yarn link-plugin && yarn pretty --check && yarn eslint --ext .ts,.js .",
|
|
24
30
|
"format": "yarn build && yarn link-plugin && yarn pretty --write && yarn eslint --fix --ext .ts,.js .",
|
|
25
31
|
"build": "tsc",
|
|
32
|
+
"prepack": "tsc",
|
|
26
33
|
"test": "yarn build && jest",
|
|
27
34
|
"link-plugin": "yarn link && yarn link eslint-plugin-jest-formatting"
|
|
28
35
|
},
|
|
29
36
|
"peerDependencies": {
|
|
30
|
-
"eslint": "
|
|
37
|
+
"eslint": "^8.0.0 || ^9.0.0 || ^10.0.0"
|
|
31
38
|
},
|
|
32
39
|
"devDependencies": {
|
|
33
|
-
"@types/eslint": "^7.
|
|
34
|
-
"@types/jest": "^
|
|
35
|
-
"@types/node": "^
|
|
36
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
37
|
-
"@typescript-eslint/parser": "^
|
|
38
|
-
"eslint": "^
|
|
39
|
-
"eslint-config-airbnb-base": "^
|
|
40
|
-
"eslint-config-prettier": "^
|
|
41
|
-
"eslint-import-resolver-typescript": "^2.
|
|
42
|
-
"eslint-plugin-import": "^2.
|
|
43
|
-
"eslint-plugin-jest": "^
|
|
40
|
+
"@types/eslint": "^7.29.0",
|
|
41
|
+
"@types/jest": "^27.0.2",
|
|
42
|
+
"@types/node": "^16.11.7",
|
|
43
|
+
"@typescript-eslint/eslint-plugin": "^5.4.0",
|
|
44
|
+
"@typescript-eslint/parser": "^5.4.0",
|
|
45
|
+
"eslint": "^8.57.1",
|
|
46
|
+
"eslint-config-airbnb-base": "^15.0.0",
|
|
47
|
+
"eslint-config-prettier": "^8.3.0",
|
|
48
|
+
"eslint-import-resolver-typescript": "^2.5.0",
|
|
49
|
+
"eslint-plugin-import": "^2.25.3",
|
|
50
|
+
"eslint-plugin-jest": "^25.2.4",
|
|
44
51
|
"eslint-plugin-jest-formatting": "file:.",
|
|
45
|
-
"eslint-plugin-prettier": "^
|
|
46
|
-
"jest": "^
|
|
47
|
-
"prettier": "2.
|
|
48
|
-
"typescript": "^
|
|
49
|
-
"ts-jest": "^
|
|
52
|
+
"eslint-plugin-prettier": "^4.0.0",
|
|
53
|
+
"jest": "^27.3.1",
|
|
54
|
+
"prettier": "2.4.1",
|
|
55
|
+
"typescript": "^4.4.4",
|
|
56
|
+
"ts-jest": "^27.0.7"
|
|
50
57
|
},
|
|
51
58
|
"engines": {
|
|
52
|
-
"node": "
|
|
59
|
+
"node": ">=22.0.0"
|
|
53
60
|
},
|
|
54
61
|
"license": "MIT"
|
|
55
62
|
}
|
package/.circleci/config.yml
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
# Javascript Node CircleCI 2.0 configuration file
|
|
2
|
-
#
|
|
3
|
-
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
|
|
4
|
-
#
|
|
5
|
-
version: 2
|
|
6
|
-
|
|
7
|
-
defaults: &defaults
|
|
8
|
-
working_directory: ~/repo
|
|
9
|
-
docker:
|
|
10
|
-
- image: circleci/node:10
|
|
11
|
-
|
|
12
|
-
jobs:
|
|
13
|
-
test:
|
|
14
|
-
<<: *defaults
|
|
15
|
-
steps:
|
|
16
|
-
- checkout
|
|
17
|
-
|
|
18
|
-
- restore_cache:
|
|
19
|
-
keys:
|
|
20
|
-
- v1-dependencies-{{ checksum "package.json" }}
|
|
21
|
-
# fallback to using the latest cache if no exact match is found
|
|
22
|
-
- v1-dependencies-
|
|
23
|
-
|
|
24
|
-
- run: yarn
|
|
25
|
-
|
|
26
|
-
- run:
|
|
27
|
-
name: Run tests
|
|
28
|
-
command: yarn test
|
|
29
|
-
|
|
30
|
-
- run: yarn lint
|
|
31
|
-
|
|
32
|
-
- save_cache:
|
|
33
|
-
paths:
|
|
34
|
-
- node_modules
|
|
35
|
-
key: v1-dependencies-{{ checksum "package.json" }}
|
|
36
|
-
|
|
37
|
-
- persist_to_workspace:
|
|
38
|
-
root: ~/repo
|
|
39
|
-
paths: .
|
|
40
|
-
deploy:
|
|
41
|
-
<<: *defaults
|
|
42
|
-
steps:
|
|
43
|
-
- attach_workspace:
|
|
44
|
-
at: ~/repo
|
|
45
|
-
- run:
|
|
46
|
-
name: Authenticate with registry
|
|
47
|
-
command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/repo/.npmrc
|
|
48
|
-
- run:
|
|
49
|
-
name: Publish package
|
|
50
|
-
command: npm publish
|
|
51
|
-
|
|
52
|
-
workflows:
|
|
53
|
-
version: 2
|
|
54
|
-
test-deploy:
|
|
55
|
-
jobs:
|
|
56
|
-
- test:
|
|
57
|
-
filters:
|
|
58
|
-
tags:
|
|
59
|
-
only: /^v.*/
|
|
60
|
-
- deploy:
|
|
61
|
-
requires:
|
|
62
|
-
- test
|
|
63
|
-
filters:
|
|
64
|
-
tags:
|
|
65
|
-
only: /^v.*/
|
|
66
|
-
branches:
|
|
67
|
-
ignore: /.*/
|
package/.eslintignore
DELETED
package/.eslintrc
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"parser": "@typescript-eslint/parser",
|
|
3
|
-
"parserOptions": {
|
|
4
|
-
"sourceType": "module"
|
|
5
|
-
},
|
|
6
|
-
"plugins": ["jest-formatting", "jest", "@typescript-eslint/eslint-plugin"],
|
|
7
|
-
"env": {
|
|
8
|
-
"jest/globals": true
|
|
9
|
-
},
|
|
10
|
-
"extends": [
|
|
11
|
-
"airbnb-base",
|
|
12
|
-
"plugin:@typescript-eslint/recommended",
|
|
13
|
-
"plugin:prettier/recommended",
|
|
14
|
-
"plugin:jest-formatting/recommended",
|
|
15
|
-
"plugin:import/typescript"
|
|
16
|
-
],
|
|
17
|
-
"overrides": [
|
|
18
|
-
{
|
|
19
|
-
"files": ["**.*"],
|
|
20
|
-
"rules": {
|
|
21
|
-
"camelcase": "off",
|
|
22
|
-
"no-plusplus": "off",
|
|
23
|
-
"import/extensions": "off"
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
],
|
|
27
|
-
"settings": {
|
|
28
|
-
"import/resolver": {
|
|
29
|
-
"typescript": {
|
|
30
|
-
"alwaysTryTypes": true // Without this `@types/estree` `estree` isn't actually in our node_modules.
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: Bug report
|
|
3
|
-
about: Create a report to help us improve
|
|
4
|
-
title: '[BUG]'
|
|
5
|
-
labels: bug
|
|
6
|
-
assignees: dangreenisrael
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
**Describe the bug**
|
|
10
|
-
A clear and concise description of what the bug is.
|
|
11
|
-
|
|
12
|
-
**To Reproduce**
|
|
13
|
-
Steps to reproduce the behavior:
|
|
14
|
-
|
|
15
|
-
1. Go to '...'
|
|
16
|
-
2. Click on '....'
|
|
17
|
-
3. Scroll down to '....'
|
|
18
|
-
4. See error
|
|
19
|
-
|
|
20
|
-
**Expected behavior**
|
|
21
|
-
A clear and concise description of what you expected to happen.
|
|
22
|
-
|
|
23
|
-
**Screenshots**
|
|
24
|
-
If applicable, add screenshots to help explain your problem.
|
|
25
|
-
|
|
26
|
-
**Desktop (please complete the following information):**
|
|
27
|
-
|
|
28
|
-
- OS: [e.g. Mac, Linux Desktop, Linux CI, Windows]
|
|
29
|
-
|
|
30
|
-
**Additional context**
|
|
31
|
-
Add any other context about the problem here.
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: Rule Request
|
|
3
|
-
about: Request a new formatting rule
|
|
4
|
-
title: '[Rule]'
|
|
5
|
-
labels: Rule Request
|
|
6
|
-
assignees: dangreenisrael
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
_Explanation of the rule_
|
|
10
|
-
|
|
11
|
-
_Valid code example_
|
|
12
|
-
|
|
13
|
-
```JavaScript
|
|
14
|
-
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
_Invalid code example_
|
|
18
|
-
|
|
19
|
-
```JavaScript
|
|
20
|
-
|
|
21
|
-
```
|
package/.prettierignore
DELETED
package/.prettierrc
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
# padding-before-after-all-blocks
|
|
2
|
-
|
|
3
|
-
## Rule Details
|
|
4
|
-
|
|
5
|
-
This rule enforces a line of padding before afterAll blocks
|
|
6
|
-
|
|
7
|
-
Examples of **incorrect** code for this rule:
|
|
8
|
-
|
|
9
|
-
```js
|
|
10
|
-
const something = 123;
|
|
11
|
-
afterAll(() => {
|
|
12
|
-
// more stuff
|
|
13
|
-
});
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
Examples of **correct** code for this rule:
|
|
17
|
-
|
|
18
|
-
```js
|
|
19
|
-
const something = 123;
|
|
20
|
-
|
|
21
|
-
afterAll(() => {
|
|
22
|
-
// more stuff
|
|
23
|
-
});
|
|
24
|
-
```
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
# padding-before-after-each-blocks
|
|
2
|
-
|
|
3
|
-
## Rule Details
|
|
4
|
-
|
|
5
|
-
This rule enforces a line of padding before afterEach blocks
|
|
6
|
-
|
|
7
|
-
Examples of **incorrect** code for this rule:
|
|
8
|
-
|
|
9
|
-
```js
|
|
10
|
-
const something = 123;
|
|
11
|
-
afterEach(() => {
|
|
12
|
-
// more stuff
|
|
13
|
-
});
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
Examples of **correct** code for this rule:
|
|
17
|
-
|
|
18
|
-
```js
|
|
19
|
-
const something = 123;
|
|
20
|
-
|
|
21
|
-
afterEach(() => {
|
|
22
|
-
// more stuff
|
|
23
|
-
});
|
|
24
|
-
```
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# padding-before-after-all-blocks
|
|
2
|
-
|
|
3
|
-
## Rule Details
|
|
4
|
-
|
|
5
|
-
This rule enforces a line of padding before all Jest tokens.
|
|
6
|
-
|
|
7
|
-
See each individual rules for examples.
|
|
8
|
-
|
|
9
|
-
- [padding-before-after-all-blocks](docs/rules/padding-before-after-all-blocks.md)
|
|
10
|
-
- [padding-before-after-each-blocks](docs/rules/padding-before-after-each-blocks.md)
|
|
11
|
-
- [padding-before-before-all-blocks](docs/rules/padding-before-before-all-blocks.md)
|
|
12
|
-
- [padding-before-before-each-blocks](docs/rules/padding-before-before-each-blocks.md)
|
|
13
|
-
- [padding-before-describe-blocks](docs/rules/padding-before-describe-blocks.md)
|
|
14
|
-
- [padding-before-expect-statements](docs/rules/padding-before-expect-statements.md)
|
|
15
|
-
- [padding-before-test-blocks](docs/rules/padding-before-test-blocks.md)
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
# padding-before-before-all-blocks
|
|
2
|
-
|
|
3
|
-
## Rule Details
|
|
4
|
-
|
|
5
|
-
This rule enforces a line of padding before beforeAll blocks
|
|
6
|
-
|
|
7
|
-
Examples of **incorrect** code for this rule:
|
|
8
|
-
|
|
9
|
-
```js
|
|
10
|
-
const something = 123;
|
|
11
|
-
beforeAll(() => {
|
|
12
|
-
// more stuff
|
|
13
|
-
});
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
Examples of **correct** code for this rule:
|
|
17
|
-
|
|
18
|
-
```js
|
|
19
|
-
const something = 123;
|
|
20
|
-
|
|
21
|
-
beforeAll(() => {
|
|
22
|
-
// more stuff
|
|
23
|
-
});
|
|
24
|
-
```
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
# padding-before-before-each-blocks
|
|
2
|
-
|
|
3
|
-
## Rule Details
|
|
4
|
-
|
|
5
|
-
This rule enforces a line of padding before beforeEach blocks
|
|
6
|
-
|
|
7
|
-
Examples of **incorrect** code for this rule:
|
|
8
|
-
|
|
9
|
-
```js
|
|
10
|
-
const something = 123;
|
|
11
|
-
beforeEach(() => {
|
|
12
|
-
// more stuff
|
|
13
|
-
});
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
Examples of **correct** code for this rule:
|
|
17
|
-
|
|
18
|
-
```js
|
|
19
|
-
const something = 123;
|
|
20
|
-
|
|
21
|
-
beforeEach(() => {
|
|
22
|
-
// more stuff
|
|
23
|
-
});
|
|
24
|
-
```
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
# padding-before-describe-blocks
|
|
2
|
-
|
|
3
|
-
## Rule Details
|
|
4
|
-
|
|
5
|
-
This rule enforces a line of padding before describe blocks
|
|
6
|
-
|
|
7
|
-
Examples of **incorrect** code for this rule:
|
|
8
|
-
|
|
9
|
-
```js
|
|
10
|
-
describe('foo', () => {
|
|
11
|
-
// stuff
|
|
12
|
-
});
|
|
13
|
-
describe('bar', () => {
|
|
14
|
-
// more stuff
|
|
15
|
-
});
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
Examples of **correct** code for this rule:
|
|
19
|
-
|
|
20
|
-
```js
|
|
21
|
-
describe('foo', () => {
|
|
22
|
-
// stuff
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
describe('bar', () => {
|
|
26
|
-
// more stuff
|
|
27
|
-
});
|
|
28
|
-
```
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
# padding-before-expect-statements
|
|
2
|
-
|
|
3
|
-
## Rule Details
|
|
4
|
-
|
|
5
|
-
This rule enforces a line of padding before non-consecutive expect statements
|
|
6
|
-
|
|
7
|
-
Examples of **incorrect** code for this rule:
|
|
8
|
-
|
|
9
|
-
```js
|
|
10
|
-
const something = 123;
|
|
11
|
-
expect(something).toEqual(123);
|
|
12
|
-
expect(something).toBeGreaterThan(0);
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
Examples of **correct** code for this rule:
|
|
16
|
-
|
|
17
|
-
```js
|
|
18
|
-
const something = 123;
|
|
19
|
-
|
|
20
|
-
expect(something).toEqual(123);
|
|
21
|
-
expect(something).toBeGreaterThan(0);
|
|
22
|
-
```
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
# padding-before-test-blocks
|
|
2
|
-
|
|
3
|
-
## Rule Details
|
|
4
|
-
|
|
5
|
-
This rule enforces a line of padding before test/it blocks
|
|
6
|
-
|
|
7
|
-
Examples of **incorrect** code for this rule:
|
|
8
|
-
|
|
9
|
-
```js
|
|
10
|
-
test('foo', () => {});
|
|
11
|
-
test('bar', () => {});
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
```js
|
|
15
|
-
it('foo', () => {});
|
|
16
|
-
it('bar', () => {});
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
Examples of **correct** code for this rule:
|
|
20
|
-
|
|
21
|
-
```js
|
|
22
|
-
test('foo', () => {});
|
|
23
|
-
|
|
24
|
-
test('bar', () => {});
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
```js
|
|
28
|
-
it('foo', () => {});
|
|
29
|
-
|
|
30
|
-
it('bar', () => {});
|
|
31
|
-
```
|
package/jest.config.js
DELETED
package/renovate.json
DELETED