-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ref #11084 Removes usage of `mocha` from eslint plugin
- Loading branch information
1 parent
fcd63fa
commit dde1b3d
Showing
8 changed files
with
364 additions
and
249 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
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
100 changes: 0 additions & 100 deletions
100
packages/eslint-plugin-sdk/test/lib/rules/no-eq-empty.js
This file was deleted.
Oops, something went wrong.
91 changes: 91 additions & 0 deletions
91
packages/eslint-plugin-sdk/test/lib/rules/no-eq-empty.test.ts
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,91 @@ | ||
import { RuleTester } from 'eslint'; | ||
import { describe } from 'vitest'; | ||
|
||
// @ts-expect-error untyped module | ||
import rule from '../../../src/rules/no-eq-empty'; | ||
|
||
describe('no-eq-empty', () => { | ||
test('ruleTester', () => { | ||
const arrayMessage = 'Do not apply the equality operator on an empty array. Use .length or Array.isArray instead.'; | ||
const objectMessage = 'Do not apply the equality operator on an empty object.'; | ||
|
||
const ruleTester = new RuleTester({ | ||
parserOptions: { | ||
ecmaVersion: 8, | ||
}, | ||
}); | ||
|
||
ruleTester.run('no-eq-empty', rule, { | ||
valid: [ | ||
{ | ||
code: 'const hey = [] === []', | ||
}, | ||
{ | ||
code: 'const hey = [] == []', | ||
}, | ||
{ | ||
code: 'const hey = {} === {}', | ||
}, | ||
{ | ||
code: 'const hey = {} == {}', | ||
}, | ||
], | ||
invalid: [ | ||
{ | ||
code: 'empty === []', | ||
errors: [ | ||
{ | ||
message: arrayMessage, | ||
type: 'BinaryExpression', | ||
}, | ||
], | ||
}, | ||
{ | ||
code: 'empty == []', | ||
errors: [ | ||
{ | ||
message: arrayMessage, | ||
type: 'BinaryExpression', | ||
}, | ||
], | ||
}, | ||
{ | ||
code: 'const hey = function() {}() === []', | ||
errors: [ | ||
{ | ||
message: arrayMessage, | ||
type: 'BinaryExpression', | ||
}, | ||
], | ||
}, | ||
{ | ||
code: 'empty === {}', | ||
errors: [ | ||
{ | ||
message: objectMessage, | ||
type: 'BinaryExpression', | ||
}, | ||
], | ||
}, | ||
{ | ||
code: 'empty == {}', | ||
errors: [ | ||
{ | ||
message: objectMessage, | ||
type: 'BinaryExpression', | ||
}, | ||
], | ||
}, | ||
{ | ||
code: 'const hey = function(){}() === {}', | ||
errors: [ | ||
{ | ||
message: objectMessage, | ||
type: 'BinaryExpression', | ||
}, | ||
], | ||
}, | ||
], | ||
}); | ||
}); | ||
}); |
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,13 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
|
||
"include": ["test/**/*", "vite.config.ts"], | ||
|
||
"compilerOptions": { | ||
"allowJs": true, | ||
// should include all types from `./tsconfig.json` plus types for all test frameworks used | ||
"types": [] | ||
|
||
// other package-specific, test-specific options | ||
} | ||
} |
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,5 @@ | ||
import baseConfig from '../../vite/vite.config'; | ||
|
||
export default { | ||
...baseConfig, | ||
}; |
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
Oops, something went wrong.