Skip to content

Commit

Permalink
Fix rule test for eslint flat config, remove warning for esm on vite
Browse files Browse the repository at this point in the history
  • Loading branch information
rlandav committed Dec 23, 2024
1 parent 006ab76 commit 4a08d49
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 22 deletions.
File renamed without changes.
55 changes: 55 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 11 additions & 11 deletions tools/core-build-tasks/src/tasks/bundle.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ describe('postProcessOutputFiles with source map files at different path', () =>
const expectedOutputFilePath = outputFile;
const expectedSourceMapFilePath = path.resolve('./dist/debug/main.js.map');
const expectedSourceMappingURL = '\n//# sourceMappingURL=../debug/main.js.map\n';
const expectedSourceMapFile = '../scripts/main';
const expectedSourceMapFile = '../scripts/main.js';

const result = postProcessOutputFiles(parameters.options, parameters.buildResult);

Expand Down Expand Up @@ -78,7 +78,7 @@ describe('postProcessOutputFiles with source map files at different path', () =>
const expectedOutputFilePath = outputFile;
const expectedSourceMapFilePath = path.resolve('./dist/debug/main.js.map');
const expectedSourceMappingURL = '\n//# sourceMappingURL=../debug/main.js.map\n';
const expectedSourceMapFile = '../scripts/main';
const expectedSourceMapFile = '../scripts/main.js';

const result = postProcessOutputFiles(parameters.options, parameters.buildResult);

Expand Down Expand Up @@ -106,7 +106,7 @@ describe('postProcessOutputFiles with source map files at different path', () =>
const expectedOutputFilePath = outputFile;
const expectedSourceMapFilePath = path.resolve('./dist/debug/main.js.map');
const expectedSourceMappingURL = '';
const expectedSourceMapFile = '../scripts/main';
const expectedSourceMapFile = '../scripts/main.js';

const result = postProcessOutputFiles(parameters.options, parameters.buildResult);

Expand Down Expand Up @@ -134,7 +134,7 @@ describe('postProcessOutputFiles with source map files at different path', () =>
const expectedOutputFilePath = outputFile;
const expectedSourceMapFilePath = path.resolve('./dist/debug/main.js.map');
const expectedSourceMappingURL = '';
const expectedSourceMapFile = '../scripts/main';
const expectedSourceMapFile = '../scripts/main.js';

const result = postProcessOutputFiles(parameters.options, parameters.buildResult);

Expand Down Expand Up @@ -162,7 +162,7 @@ describe('postProcessOutputFiles with source map files at different path', () =>
const expectedOutputFilePath = outputFile;
const expectedSourceMapFilePath = path.resolve('./dist/debug/main.js.map');
const expectedSourceMappingURL = '';
const expectedSourceMapFile = '../scripts/main';
const expectedSourceMapFile = '../scripts/main.js';

const result = postProcessOutputFiles(parameters.options, parameters.buildResult);

Expand Down Expand Up @@ -193,7 +193,7 @@ describe('postProcessOutputFiles with source map files at same path', () => {
const expectedOutputFilePath = outputFile;
const expectedSourceMapFilePath = path.resolve('./dist/scripts/main.js.map');
const expectedSourceMappingURL = '\n//# sourceMappingURL=main.js.map\n';
const expectedSourceMapFile = 'main';
const expectedSourceMapFile = 'main.js';

const result = postProcessOutputFiles(parameters.options, parameters.buildResult);

Expand Down Expand Up @@ -221,7 +221,7 @@ describe('postProcessOutputFiles with source map files at same path', () => {
const expectedOutputFilePath = outputFile;
const expectedSourceMapFilePath = path.resolve('./dist/scripts/main.js.map');
const expectedSourceMappingURL = '\n//# sourceMappingURL=main.js.map\n';
const expectedSourceMapFile = 'main';
const expectedSourceMapFile = 'main.js';

const result = postProcessOutputFiles(parameters.options, parameters.buildResult);

Expand Down Expand Up @@ -249,7 +249,7 @@ describe('postProcessOutputFiles with source map files at same path', () => {
const expectedOutputFilePath = outputFile;
const expectedSourceMapFilePath = path.resolve('./dist/scripts/main.js.map');
const expectedSourceMappingURL = '\n//# sourceMappingURL=main.js.map\n';
const expectedSourceMapFile = 'main';
const expectedSourceMapFile = 'main.js';

const result = postProcessOutputFiles(parameters.options, parameters.buildResult);

Expand Down Expand Up @@ -277,7 +277,7 @@ describe('postProcessOutputFiles with source map files at same path', () => {
const expectedOutputFilePath = outputFile;
const expectedSourceMapFilePath = path.resolve('./dist/scripts/main.js.map');
const expectedSourceMappingURL = '';
const expectedSourceMapFile = 'main';
const expectedSourceMapFile = 'main.js';

const result = postProcessOutputFiles(parameters.options, parameters.buildResult);

Expand Down Expand Up @@ -305,7 +305,7 @@ describe('postProcessOutputFiles with source map files at same path', () => {
const expectedOutputFilePath = outputFile;
const expectedSourceMapFilePath = path.resolve('./dist/scripts/main.js.map');
const expectedSourceMappingURL = '';
const expectedSourceMapFile = 'main';
const expectedSourceMapFile = 'main.js';

const result = postProcessOutputFiles(parameters.options, parameters.buildResult);

Expand Down Expand Up @@ -333,7 +333,7 @@ describe('postProcessOutputFiles with source map files at same path', () => {
const expectedOutputFilePath = outputFile;
const expectedSourceMapFilePath = path.resolve('./dist/scripts/main.js.map');
const expectedSourceMappingURL = '';
const expectedSourceMapFile = 'main';
const expectedSourceMapFile = 'main.js';

const result = postProcessOutputFiles(parameters.options, parameters.buildResult);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
import { configDefaults, defineConfig } from 'vitest/config';

export default defineConfig({
test: { exclude: [...configDefaults.exclude, '**/build/**', '**/lib/**'], watch: false },
test: { exclude: [...configDefaults.exclude, '**/build/**', '**/lib/**', '**/lib-cjs/**'], watch: false },
});
5 changes: 3 additions & 2 deletions tools/eslint-plugin-minecraft-linting/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@
"tsconfig": "*"
},
"dependencies": {
"@typescript-eslint/utils": "^8.18.1",
"@typescript-eslint/parser": "^8.18.1",
"@typescript-eslint/eslint-plugin": "^8.18.1",
"@typescript-eslint/parser": "^8.18.1",
"@typescript-eslint/rule-tester": "^8.18.1",
"@typescript-eslint/utils": "^8.18.1",
"eslint": "^9.17.0"
},
"publishConfig": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,29 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import { TSESLint } from '@typescript-eslint/utils';
import { RuleTester } from '@typescript-eslint/rule-tester';
import * as path from 'path';
import { describe, it } from 'vitest';
import { describe, it, afterAll } from 'vitest';
import AvoidUnnecessaryCommand from './AvoidUnnecessaryCommand.js';
import globals from 'globals';

// RuleTester needs some global setup to integrate with test runners
RuleTester.afterAll = afterAll;
RuleTester.describe = describe;
RuleTester.it = it;
RuleTester.itOnly = it;

describe('AvoidUnnecessaryCommand', () => {
it('Passes TSESList.RuleTester', () => {
const ruleTester = new TSESLint.RuleTester({
parser: require.resolve('@typescript-eslint/parser'),
parserOptions: {
sourceType: 'module',
tsconfigRootDir: path.join(__dirname, './TestProject'),
project: path.join(__dirname, '../../tsconfig.json'),
const ruleTester = new RuleTester({
languageOptions: {
parserOptions: {
ecmaVersion: 'latest',
project: path.join(__dirname, '../../tsconfig.json'),
},
globals: {
...globals.node,
},
},
});

Expand Down
File renamed without changes.

0 comments on commit 4a08d49

Please sign in to comment.