Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ref(eslint): Remove mocha #11296

Merged
merged 2 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,11 @@ module.exports = {
'no-console': 'off',
},
},
{
files: ['vite.config.ts'],
parserOptions: {
project: ['tsconfig.test.json'],
},
},
],
};
10 changes: 3 additions & 7 deletions packages/eslint-plugin-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,13 @@
"publishConfig": {
"access": "public"
},
"dependencies": {
"requireindex": "~1.1.0"
},
"devDependencies": {
"mocha": "^6.2.0"
},
"dependencies": {},
"scripts": {
"clean": "yarn rimraf sentry-internal-eslint-plugin-sdk-*.tgz",
"fix": "eslint . --format stylish --fix",
"lint": "eslint . --format stylish",
"test": "mocha test --recursive",
"test": "vitest run",
"test:watch": "vitest --watch",
"build:tarball": "npm pack",
"circularDepCheck": "madge --circular src/index.js"
},
Expand Down
100 changes: 0 additions & 100 deletions packages/eslint-plugin-sdk/test/lib/rules/no-eq-empty.js

This file was deleted.

91 changes: 91 additions & 0 deletions packages/eslint-plugin-sdk/test/lib/rules/no-eq-empty.test.ts
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',
},
],
},
],
});
})
})
13 changes: 13 additions & 0 deletions packages/eslint-plugin-sdk/tsconfig.test.json
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
}
}
5 changes: 5 additions & 0 deletions packages/eslint-plugin-sdk/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import baseConfig from '../../vite/vite.config';

export default {
...baseConfig,
};
2 changes: 1 addition & 1 deletion packages/sveltekit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"fix": "eslint . --format stylish --fix",
"lint": "eslint . --format stylish",
"test": "yarn test:unit",
"test:unit": "vitest run --outputDiffMaxLines=2000",
"test:unit": "vitest run",
"test:watch": "vitest --watch",
"yalc:publish": "ts-node ../../scripts/prepack.ts && yalc publish build --push --sig"
},
Expand Down
Loading
Loading