eslint-plugin-jest 27.3.0 → 27.4.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.
@@ -125,7 +125,8 @@ describe('foo', () => {
125
125
 
126
126
  **accidentalSpace**
127
127
 
128
- A `describe` / `test` block should not contain accidentalSpace
128
+ A `describe` / `test` block should not contain accidentalSpace, but can be
129
+ turned off via the `ignoreSpaces` option:
129
130
 
130
131
  Examples of **incorrect** code for this rule
131
132
 
@@ -161,6 +162,7 @@ describe('foo', () => {
161
162
 
162
163
  ```ts
163
164
  interface Options {
165
+ ignoreSpaces?: boolean;
164
166
  ignoreTypeOfDescribeName?: boolean;
165
167
  disallowedWords?: string[];
166
168
  mustNotMatch?: Partial<Record<'describe' | 'test' | 'it', string>> | string;
@@ -168,6 +170,12 @@ interface Options {
168
170
  }
169
171
  ```
170
172
 
173
+ #### `ignoreSpaces`
174
+
175
+ Default: `false`
176
+
177
+ When enabled, the leading and trailing spaces won't be checked.
178
+
171
179
  #### `ignoreTypeOfDescribeName`
172
180
 
173
181
  Default: `false`
@@ -68,6 +68,10 @@ var _default = (0, _utils2.createRule)({
68
68
  schema: [{
69
69
  type: 'object',
70
70
  properties: {
71
+ ignoreSpaces: {
72
+ type: 'boolean',
73
+ default: false
74
+ },
71
75
  ignoreTypeOfDescribeName: {
72
76
  type: 'boolean',
73
77
  default: false
@@ -101,10 +105,12 @@ var _default = (0, _utils2.createRule)({
101
105
  fixable: 'code'
102
106
  },
103
107
  defaultOptions: [{
108
+ ignoreSpaces: false,
104
109
  ignoreTypeOfDescribeName: false,
105
110
  disallowedWords: []
106
111
  }],
107
112
  create(context, [{
113
+ ignoreSpaces,
108
114
  ignoreTypeOfDescribeName,
109
115
  disallowedWords = [],
110
116
  mustNotMatch,
@@ -159,7 +165,7 @@ var _default = (0, _utils2.createRule)({
159
165
  return;
160
166
  }
161
167
  }
162
- if (title.trim().length !== title.length) {
168
+ if (ignoreSpaces === false && title.trim().length !== title.length) {
163
169
  context.report({
164
170
  messageId: 'accidentalSpace',
165
171
  node: argument,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-jest",
3
- "version": "27.3.0",
3
+ "version": "27.4.0",
4
4
  "description": "ESLint rules for Jest",
5
5
  "keywords": [
6
6
  "eslint",