Skip to content

Commit

Permalink
test(eslint-config-ali): fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
guoyunhe committed Jan 2, 2025
1 parent 8066a7f commit 0e0d1ba
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 48 deletions.
1 change: 0 additions & 1 deletion packages/eslint-config-ali/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
"lint": "rive lint",
"lint:fix": "rive lint --fix",
"prepublishOnly": "npm run test",
"print-config": "eslint --print-config ./index.js > ./print-config.json",
"start": "rive start",
"test": "rive test",
"test:ui": "rive test --ui",
Expand Down
20 changes: 0 additions & 20 deletions packages/eslint-config-ali/test/self-lint.test.js

This file was deleted.

16 changes: 16 additions & 0 deletions packages/eslint-config-ali/test/self-lint.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { ESLint } from 'eslint';
import path from 'path';
import { base } from '../src';

describe('test/self-lint.test.js', () => {
it('Repo self should pass lint', async () => {
const cli = new ESLint({
baseConfig: base,
overrideConfigFile: true,
ignore: true,
});

const reports = await cli.lintFiles([path.join(import.meta.dirname, '../src')]);
expect(reports.reduce((count, { errorCount }) => errorCount + count, 0)).toBe(0);
});
});
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
const assert = require('assert');
const eslint = require('eslint');
const path = require('path');
import { ESLint } from 'eslint';
import path from 'node:path';

describe('test/use-babel-eslint.test.js', () => {
it('babel-eslint parser run well for react', async () => {
const configPath = './react.js';
const filePath = path.join(__dirname, './fixtures/use-babel-eslint.jsx');
const filePath = path.join(import.meta.dirname, './fixtures/use-babel-eslint.jsx');

const cli = new eslint.ESLint({
const cli = new ESLint({
overrideConfigFile: configPath,
useEslintrc: false,
ignore: false,
});

Expand All @@ -29,11 +27,10 @@ describe('test/use-babel-eslint.test.js', () => {

it('babel-eslint parser run well for vue', async () => {
const configPath = './vue.js';
const filePath = path.join(__dirname, './fixtures/vue.vue');
const filePath = path.join(import.meta.dirname, './fixtures/vue.vue');

const cli = new eslint.ESLint({
const cli = new ESLint({
overrideConfigFile: configPath,
useEslintrc: false,
ignore: false,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ describe('Validate JS configs', () => {

const cli = new eslint.ESLint({
overrideConfigFile: configPath,
useEslintrc: false, // 如果不关这个参数,会将目录下的 eslintrc 与 overrideConfigFile merge
ignore: false,
});

Expand All @@ -43,7 +42,7 @@ describe('Validate JS configs', () => {

const cli = new eslint.ESLint({
overrideConfigFile: configPath,
useEslintrc: false,

ignore: false,
});

Expand Down Expand Up @@ -71,7 +70,7 @@ describe('Validate JS configs', () => {

const cli = new eslint.ESLint({
overrideConfigFile: configPath,
useEslintrc: false,

ignore: false,
});

Expand Down Expand Up @@ -116,7 +115,7 @@ describe('Validate JS configs', () => {

const cli = new eslint.ESLint({
overrideConfigFile: configPath,
useEslintrc: false,

ignore: false,
});

Expand All @@ -137,7 +136,7 @@ describe('Validate JS configs', () => {

const cli = new eslint.ESLint({
overrideConfigFile: configPath,
useEslintrc: false,

ignore: false,
});

Expand Down Expand Up @@ -165,7 +164,7 @@ describe('Validate JS configs', () => {

const cli = new eslint.ESLint({
overrideConfigFile: configPath,
useEslintrc: false,

ignore: false,
});

Expand Down Expand Up @@ -201,7 +200,7 @@ describe('Validate JS configs', () => {

const cli = new eslint.ESLint({
overrideConfigFile: configPath,
useEslintrc: false,

ignore: false,
});

Expand Down Expand Up @@ -234,7 +233,7 @@ describe('Validate JS configs', () => {

const cli = new eslint.ESLint({
overrideConfigFile: configPath,
useEslintrc: false,

ignore: false,
});

Expand Down Expand Up @@ -267,7 +266,7 @@ describe('Validate JS configs', () => {

const cli = new eslint.ESLint({
overrideConfigFile: configPath,
useEslintrc: false,

ignore: false,
});

Expand Down Expand Up @@ -301,7 +300,7 @@ describe('Validate JS configs', () => {

const cli = new eslint.ESLint({
overrideConfigFile: configPath,
useEslintrc: false,

ignore: false,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('Validate TS configs', () => {

const cli = new eslint.ESLint({
overrideConfigFile: configPath,
useEslintrc: false,

ignore: false,
overrideConfig: {
parserOptions: {
Expand Down Expand Up @@ -63,7 +63,7 @@ describe('Validate TS configs', () => {
const configPath = './typescript/react.js';
const cli = new eslint.ESLint({
overrideConfigFile: configPath,
useEslintrc: false,

ignore: false,
overrideConfig: {
parserOptions: {
Expand Down Expand Up @@ -111,7 +111,7 @@ describe('Validate TS configs', () => {
const configPath = './typescript/rax.js';
const cli = new eslint.ESLint({
overrideConfigFile: configPath,
useEslintrc: false,

ignore: false,
overrideConfig: {
parserOptions: {
Expand Down Expand Up @@ -139,7 +139,7 @@ describe('Validate TS configs', () => {

const cli = new eslint.ESLint({
overrideConfigFile: configPath,
useEslintrc: false,

ignore: false,
overrideConfig: {
parserOptions: {
Expand Down Expand Up @@ -176,7 +176,7 @@ describe('Validate TS configs', () => {

const cli = new eslint.ESLint({
overrideConfigFile: configPath,
useEslintrc: false,

ignore: false,
overrideConfig: {
parserOptions: {
Expand Down Expand Up @@ -217,7 +217,7 @@ describe('Validate TS configs', () => {

const cli = new eslint.ESLint({
overrideConfigFile: configPath,
useEslintrc: false,

ignore: false,
overrideConfig: {
parserOptions: {
Expand Down Expand Up @@ -266,7 +266,7 @@ describe('Validate TS configs', () => {

const cli = new eslint.ESLint({
overrideConfigFile: configPath,
useEslintrc: false,

ignore: false,
overrideConfig: {
parserOptions: {
Expand Down Expand Up @@ -305,7 +305,7 @@ describe('Validate TS configs', () => {

const cli = new eslint.ESLint({
overrideConfigFile: configPath,
useEslintrc: false,

ignore: false,
});

Expand Down

0 comments on commit 0e0d1ba

Please sign in to comment.