Skip to content

Commit

Permalink
chore: duplicate eslint rules locally to allow warning (#10579)
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Rath committed Oct 4, 2020
1 parent bc1b16a commit ad29e80
Show file tree
Hide file tree
Showing 17 changed files with 58 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .eslintplugin/index.js
Expand Up @@ -9,4 +9,6 @@ exports.rules = {
'ban-types-eventually': require('@typescript-eslint/eslint-plugin').rules[
'ban-types'
],
'prefer-rest-params-eventually': require('eslint/lib/rules/prefer-rest-params'),
'prefer-spread-eventually': require('eslint/lib/rules/prefer-spread'),
};
35 changes: 34 additions & 1 deletion .eslintrc.js
Expand Up @@ -32,8 +32,41 @@ module.exports = {
'import/default': 'off',
'no-dupe-class-members': 'off',
'no-unused-vars': 'off',
// TODO: turn these on at some point
},
},
{
files: [
'packages/jest-jasmine2/src/jasmine/Env.ts',
'packages/jest-jasmine2/src/jasmine/ReportDispatcher.ts',
'packages/jest-jasmine2/src/jasmine/Spec.ts',
'packages/jest-jasmine2/src/jasmine/SpyStrategy.ts',
'packages/jest-jasmine2/src/jasmine/Suite.ts',
'packages/jest-jasmine2/src/jasmine/createSpy.ts',
'packages/jest-jasmine2/src/jasmine/jasmineLight.ts',
'packages/jest-mock/src/__tests__/index.test.ts',
'packages/jest-mock/src/index.ts',
'packages/pretty-format/src/__tests__/Immutable.test.ts',
'packages/pretty-format/src/__tests__/prettyFormat.test.ts',
],
rules: {
'local/prefer-rest-params-eventually': 'warn',
'prefer-rest-params': 'off',
},
},
{
files: [
'packages/expect/src/index.ts',
'packages/jest-fake-timers/src/legacyFakeTimers.ts',
'packages/jest-jasmine2/src/jasmine/Env.ts',
'packages/jest-jasmine2/src/jasmine/ReportDispatcher.ts',
'packages/jest-jasmine2/src/jasmine/Spec.ts',
'packages/jest-jasmine2/src/jasmine/Suite.ts',
'packages/jest-jasmine2/src/jasmine/jasmineLight.ts',
'packages/jest-jasmine2/src/jestExpect.ts',
'packages/jest-resolve/src/index.ts',
],
rules: {
'local/prefer-spread-eventually': 'warn',
'prefer-spread': 'off',
},
},
Expand Down
2 changes: 2 additions & 0 deletions packages/expect/src/index.ts
Expand Up @@ -6,6 +6,8 @@
*
*/

/* eslint-disable local/prefer-spread-eventually */

import * as matcherUtils from 'jest-matcher-utils';
import type {
AsyncExpectationResult,
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-fake-timers/src/legacyFakeTimers.ts
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

/* eslint-disable local/ban-types-eventually */
/* eslint-disable local/ban-types-eventually, local/prefer-spread-eventually */

import util = require('util');
import type {ModuleMocker} from 'jest-mock';
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-jasmine2/src/jasmine/Env.ts
Expand Up @@ -28,7 +28,7 @@ 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.
*/
/* eslint-disable sort-keys */
/* eslint-disable sort-keys, local/prefer-spread-eventually, local/prefer-rest-params-eventually */

import {AssertionError} from 'assert';
import chalk = require('chalk');
Expand Down
3 changes: 3 additions & 0 deletions packages/jest-jasmine2/src/jasmine/ReportDispatcher.ts
Expand Up @@ -28,6 +28,9 @@ 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.
*/

/* eslint-disable local/prefer-spread-eventually, local/prefer-rest-params-eventually */

import type {Reporter, RunDetails} from '../types';
import type {SpecResult} from './Spec';
import type {SuiteResult} from './Suite';
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-jasmine2/src/jasmine/Spec.ts
Expand Up @@ -28,7 +28,7 @@ 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.
*/
/* eslint-disable sort-keys */
/* eslint-disable sort-keys, local/prefer-spread-eventually, local/prefer-rest-params-eventually */

import {AssertionError} from 'assert';
import type {Config} from '@jest/types';
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-jasmine2/src/jasmine/SpyStrategy.ts
Expand Up @@ -29,7 +29,7 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

/* eslint-disable local/ban-types-eventually */
/* eslint-disable local/ban-types-eventually, local/prefer-rest-params-eventually */

export default class SpyStrategy {
identity: () => string;
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-jasmine2/src/jasmine/Suite.ts
Expand Up @@ -29,7 +29,7 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

/* eslint-disable local/ban-types-eventually, sort-keys */
/* eslint-disable local/ban-types-eventually, sort-keys, local/prefer-spread-eventually, local/prefer-rest-params-eventually */

import {convertDescriptorToString} from 'jest-util';
import type {Config} from '@jest/types';
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-jasmine2/src/jasmine/createSpy.ts
Expand Up @@ -28,7 +28,7 @@ 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.
*/
/* eslint-disable sort-keys */
/* eslint-disable sort-keys, local/prefer-rest-params-eventually */

import type {Spy} from '../types';
import CallTracker, {Context} from './CallTracker';
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-jasmine2/src/jasmine/jasmineLight.ts
Expand Up @@ -28,7 +28,7 @@ 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.
*/
/* eslint-disable sort-keys */
/* eslint-disable sort-keys, local/prefer-spread-eventually, local/prefer-rest-params-eventually */

import type {Jasmine, SpecDefinitionsFn} from '../types';
import createSpy from './createSpy';
Expand Down
2 changes: 2 additions & 0 deletions packages/jest-jasmine2/src/jestExpect.ts
Expand Up @@ -5,6 +5,8 @@
* LICENSE file in the root directory of this source tree.
*/

/* eslint-disable local/prefer-spread-eventually */

import expect = require('expect');
import type {Global} from '@jest/types';
import {
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-mock/src/__tests__/index.test.ts
Expand Up @@ -6,7 +6,7 @@
*
*/

/* eslint-disable local/ban-types-eventually */
/* eslint-disable local/ban-types-eventually, local/prefer-rest-params-eventually */

import vm, {Context} from 'vm';
import {ModuleMocker} from '../';
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-mock/src/index.ts
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

/* eslint-disable local/ban-types-eventually */
/* eslint-disable local/ban-types-eventually, local/prefer-rest-params-eventually */

type Global = NodeJS.Global; // | Window – add once TS improves typings;

Expand Down
2 changes: 2 additions & 0 deletions packages/jest-resolve/src/index.ts
Expand Up @@ -5,6 +5,8 @@
* LICENSE file in the root directory of this source tree.
*/

/* eslint-disable local/prefer-spread-eventually */

import * as path from 'path';
import type {Config} from '@jest/types';
import type {ModuleMap} from 'jest-haste-map';
Expand Down
2 changes: 2 additions & 0 deletions packages/pretty-format/src/__tests__/Immutable.test.ts
Expand Up @@ -5,6 +5,8 @@
* LICENSE file in the root directory of this source tree.
*/

/* eslint-disable local/prefer-rest-params-eventually */

import React from 'react';
import Immutable from 'immutable';

Expand Down
2 changes: 2 additions & 0 deletions packages/pretty-format/src/__tests__/prettyFormat.test.ts
Expand Up @@ -5,6 +5,8 @@
* LICENSE file in the root directory of this source tree.
*/

/* eslint-disable local/prefer-rest-params-eventually */

import prettyFormat from '../';

function returnArguments(..._args: Array<unknown>) {
Expand Down

0 comments on commit ad29e80

Please sign in to comment.