Skip to content

Commit

Permalink
Update eslint config and remove legacy mode set-up (#366)
Browse files Browse the repository at this point in the history
  • Loading branch information
devpow112 authored Oct 29, 2024
1 parent 177276d commit 3d0a778
Show file tree
Hide file tree
Showing 13 changed files with 107 additions and 90 deletions.
7 changes: 0 additions & 7 deletions .eslintrc.json

This file was deleted.

1 change: 1 addition & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ updates:
patterns:
- eslint
- eslint-*
- '@eslint/*'
chai:
dependency-type: development
patterns:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
cache: npm
- name: Install dependencies
run: npm ci
- name: Lint (JavaScript)
- name: Lint (ESLint)
run: npm run lint:eslint
licenses:
name: Check Licenses
Expand Down
61 changes: 61 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import js from '@eslint/js';
import { FlatCompat } from '@eslint/eslintrc';
import { includeIgnoreFile } from '@eslint/compat';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const gitignorePath = path.resolve(__dirname, '.gitignore');
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});

export default [
includeIgnoreFile(gitignorePath),
...compat.extends('brightspace/node-config').map((config) => ({
...config,
files: ['**/*.js', '**/*.cjs'],
rules: {
...config.rules,
'comma-dangle': 'error'
}
})),
...compat.extends(
'brightspace/testing-config',
'plugin:mocha/recommended'
).map((config) => ({
...config,
files: ['test/**/*.test.js'],
rules: {
...config.rules,
'mocha/no-exclusive-tests': 'error',
'mocha/no-mocha-arrows': 'off'
}
})),
...compat.extends(
'brightspace/testing-config',
'plugin:mocha/recommended'
).map((config) => ({
...config,
files: ['test/integration/data/tests/**/*.test.js'],
rules: {
...config.rules,
'mocha/no-mocha-arrows': 'off',
'mocha/no-skipped-tests': 'off',
'no-console': 'off'
}
})),
...compat.extends('plugin:playwright/recommended').map((config) => ({
...config,
files: ['test/integration/data/tests/playwright/*.js'],
rules: {
...config.rules,
'playwright/expect-expect': 'off',
'playwright/no-conditional-in-test': 'off',
'playwright/no-skipped-test': 'off'
}
}))
];
60 changes: 30 additions & 30 deletions package-lock.json

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

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"scripts": {
"license-check": "d2l-license-checker -p",
"lint": "npm run lint:eslint",
"lint:eslint": "cross-env ESLINT_USE_FLAT_CONFIG=false eslint . --ext .js,.cjs",
"lint:eslint": "eslint",
"fix": "npm run fix:eslint",
"fix:eslint": "npm run lint:eslint -- --fix",
"test": "run-s lint test:all",
Expand Down Expand Up @@ -55,14 +55,16 @@
"playwright-core": "^1.48"
},
"devDependencies": {
"@eslint/compat": "^1",
"@eslint/eslintrc": "^3",
"@eslint/js": "^9",
"@playwright/test": "^1",
"@web/test-runner": "^0.19",
"@web/test-runner-playwright": "^0.11",
"@web/test-runner-puppeteer": "^0.17",
"c8": "^10",
"chai": "^5",
"chai-subset": "^1",
"cross-env": "^7",
"d2l-license-checker": "^4",
"eslint": "^9",
"eslint-config-brightspace": "^1",
Expand Down
18 changes: 0 additions & 18 deletions test/.eslintrc.json

This file was deleted.

5 changes: 0 additions & 5 deletions test/integration/data/tests/.eslintrc.json

This file was deleted.

14 changes: 0 additions & 14 deletions test/integration/data/tests/playwright/.eslintrc.json

This file was deleted.

1 change: 0 additions & 1 deletion test/integration/data/tests/playwright/reporter-1.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ test.describe('reporter 1', () => {

test.skip('skipped', () => {});

// eslint-disable-next-line no-empty-pattern
test('flaky', async({}, testInfo) => {
if (testInfo.retry < 2) {
await delay();
Expand Down
1 change: 0 additions & 1 deletion test/integration/data/tests/playwright/reporter-2.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ test.describe('reporter 2', () => {

test.skip('skipped', () => {});

// eslint-disable-next-line no-empty-pattern
test('flaky', async({}, testInfo) => {
if (testInfo.retry < 2) {
await delay();
Expand Down
1 change: 0 additions & 1 deletion test/integration/data/tests/playwright/reporter-3.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ test.describe('reporter 3', () => {

test.skip('skipped', () => {});

// eslint-disable-next-line no-empty-pattern
test('flaky', async({}, testInfo) => {
if (testInfo.retry < 2) {
await delay();
Expand Down
20 changes: 10 additions & 10 deletions test/integration/data/validation/test-report-playwright.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ export const testReportV2Partial = {
status: 'failed',
location: {
file: 'test/integration/data/tests/playwright/reporter-1.test.js',
line: 27,
line: 26,
column: 2
},
browser: 'chromium',
Expand Down Expand Up @@ -319,7 +319,7 @@ export const testReportV2Partial = {
status: 'failed',
location: {
file: 'test/integration/data/tests/playwright/reporter-2.test.js',
line: 27,
line: 26,
column: 2
},
browser: 'chromium',
Expand All @@ -333,7 +333,7 @@ export const testReportV2Partial = {
status: 'failed',
location: {
file: 'test/integration/data/tests/playwright/reporter-2.test.js',
line: 27,
line: 26,
column: 2
},
browser: 'firefox',
Expand Down Expand Up @@ -361,7 +361,7 @@ export const testReportV2Partial = {
status: 'failed',
location: {
file: 'test/integration/data/tests/playwright/reporter-1.test.js',
line: 27,
line: 26,
column: 2
},
browser: 'webkit',
Expand All @@ -375,7 +375,7 @@ export const testReportV2Partial = {
status: 'passed',
location: {
file: 'test/integration/data/tests/playwright/reporter-1.test.js',
line: 17,
line: 16,
column: 2
},
browser: 'chromium',
Expand All @@ -389,7 +389,7 @@ export const testReportV2Partial = {
status: 'passed',
location: {
file: 'test/integration/data/tests/playwright/reporter-2.test.js',
line: 17,
line: 16,
column: 2
},
browser: 'chromium',
Expand All @@ -403,7 +403,7 @@ export const testReportV2Partial = {
status: 'passed',
location: {
file: 'test/integration/data/tests/playwright/reporter-1.test.js',
line: 17,
line: 16,
column: 2
},
browser: 'webkit',
Expand Down Expand Up @@ -431,7 +431,7 @@ export const testReportV2Partial = {
status: 'passed',
location: {
file: 'test/integration/data/tests/playwright/reporter-2.test.js',
line: 17,
line: 16,
column: 2
},
browser: 'firefox',
Expand Down Expand Up @@ -459,7 +459,7 @@ export const testReportV2Partial = {
status: 'failed',
location: {
file: 'test/integration/data/tests/playwright/reporter-2.test.js',
line: 27,
line: 26,
column: 2
},
browser: 'webkit',
Expand All @@ -473,7 +473,7 @@ export const testReportV2Partial = {
status: 'passed',
location: {
file: 'test/integration/data/tests/playwright/reporter-2.test.js',
line: 17,
line: 16,
column: 2
},
browser: 'webkit',
Expand Down

0 comments on commit 3d0a778

Please sign in to comment.