Skip to content

Commit

Permalink
Reorganize linters and fixers (#22650)
Browse files Browse the repository at this point in the history
* Reorganize linters and fixers

* Fix import

* Fix commands in package.json
  • Loading branch information
queengooborg authored Mar 28, 2024
1 parent 09a858f commit 4d6bfff
Show file tree
Hide file tree
Showing 48 changed files with 30 additions and 30 deletions.
16 changes: 8 additions & 8 deletions scripts/fix/index.ts → lint/fix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import { fileURLToPath } from 'node:url';
import esMain from 'es-main';
import chalk from 'chalk-template';

import fixBrowserOrder from './browser-order.js';
import fixFeatureOrder from './feature-order.js';
import fixPropertyOrder from './property-order.js';
import fixStatementOrder from './statement-order.js';
import fixFlags from './flags.js';
import fixLinks from './links.js';
import fixStatus from './status.js';
import fixMirror from './mirror.js';
import fixBrowserOrder from './fixer/browser-order.js';
import fixFeatureOrder from './fixer/feature-order.js';
import fixPropertyOrder from './fixer/property-order.js';
import fixStatementOrder from './fixer/statement-order.js';
import fixFlags from './fixer/flags.js';
import fixLinks from './fixer/links.js';
import fixStatus from './fixer/status.js';
import fixMirror from './fixer/mirror.js';

const dirname = fileURLToPath(new URL('.', import.meta.url));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
CompatStatement,
SupportBlock,
} from '../../types/types.js';
import { IS_WINDOWS } from '../../test/utils.js';
import { IS_WINDOWS } from '../utils.js';

/**
* Return a new "support_block" object whose first-level properties
Expand Down
4 changes: 2 additions & 2 deletions scripts/fix/feature-order.ts → lint/fixer/feature-order.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import fs from 'node:fs';

import { Identifier } from '../../types/types.js';
import compareFeatures from '../lib/compare-features.js';
import { IS_WINDOWS } from '../../test/utils.js';
import compareFeatures from '../../scripts/lib/compare-features.js';
import { IS_WINDOWS } from '../utils.js';

/**
* Return a new feature object whose first-level properties have been
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions scripts/fix/flags.ts → lint/fixer/flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import {
SupportStatement,
SimpleSupportStatement,
} from '../../types/types.js';
import { IS_WINDOWS } from '../../test/utils.js';
import { IS_WINDOWS } from '../utils.js';
import testFlags, {
isIrrelevantFlagData,
getBasicSupportStatement,
} from '../../test/linter/test-flags.js';
} from '../linter/test-flags.js';
import walk from '../../utils/walk.js';

/**
Expand Down
4 changes: 2 additions & 2 deletions scripts/fix/links.ts → lint/fixer/links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

import fs from 'node:fs';

import { IS_WINDOWS } from '../../test/utils.js';
import { processData } from '../../test/linter/test-links.js';
import { IS_WINDOWS } from '../utils.js';
import { processData } from '../linter/test-links.js';

/**
* Fix issues with links throughout the BCD files
Expand Down
2 changes: 1 addition & 1 deletion scripts/fix/mirror.ts → lint/fixer/mirror.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
} from '../../types/index.js';
import bcd from '../../index.js';
import { walk } from '../../utils/index.js';
import mirrorSupport from '../build/mirror.js';
import mirrorSupport from '../../scripts/build/mirror.js';

const downstreamBrowsers = (
Object.keys(bcd.browsers) as (keyof typeof bcd.browsers)[]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

import fs from 'node:fs';

import { IS_WINDOWS } from '../../test/utils.js';
import stringifyAndOrderProperties from '../lib/stringify-and-order-properties.js';
import { IS_WINDOWS } from '../utils.js';
import stringifyAndOrderProperties from '../../scripts/lib/stringify-and-order-properties.js';

/**
* Fix issues with the property order throughout the BCD files
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import fs from 'node:fs';

import { BrowserName, CompatStatement } from '../../types/types.js';
import { IS_WINDOWS } from '../../test/utils.js';
import compareStatements from '../lib/compare-statements.js';
import { IS_WINDOWS } from '../utils.js';
import compareStatements from '../../scripts/lib/compare-statements.js';

/**
* Return a new "support_block" object whose support statements have
Expand Down
4 changes: 2 additions & 2 deletions scripts/fix/status.ts → lint/fixer/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import fs from 'node:fs';

import { Identifier } from '../../types/types.js';
import { checkExperimental } from '../../test/linter/test-status.js';
import { IS_WINDOWS } from '../../test/utils.js';
import { checkExperimental } from '../linter/test-status.js';
import { IS_WINDOWS } from '../utils.js';

/**
* Fix the status values
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion test/linter/test-mirror.ts → lint/linter/test-mirror.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { BrowserName } from '../../types/types.js';
import { InternalSupportBlock } from '../../types/index';
import bcd from '../../index.js';
const { browsers } = bcd;
import { isMirrorEquivalent } from '../../scripts/fix/mirror.js';
import { isMirrorEquivalent } from '../fixer/mirror.js';

/**
* Check the data to ensure all statements that should use `mirror` do
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions test/linter/test-style.ts → lint/linter/test-style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import {
indexToPos,
jsonDiff,
} from '../utils.js';
import { orderSupportBlock } from '../../scripts/fix/browser-order.js';
import { orderFeatures } from '../../scripts/fix/feature-order.js';
import { orderStatements } from '../../scripts/fix/statement-order.js';
import { orderSupportBlock } from '../fixer//browser-order.js';
import { orderFeatures } from '../fixer//feature-order.js';
import { orderStatements } from '../fixer//statement-order.js';
import stringifyAndOrderProperties from '../../scripts/lib/stringify-and-order-properties.js';

/**
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@
"coverage": "c8 report -r lcov && open-cli coverage/lcov-report/index.html",
"format": "eslint . && prettier --check .",
"format:fix": "eslint --quiet --fix . && prettier --write .",
"lint": "node --loader=ts-node/esm --no-warnings=ExperimentalWarning test/lint.ts",
"lint:fix": "node --loader=ts-node/esm --no-warnings=ExperimentalWarning scripts/fix/index.ts",
"lint": "node --loader=ts-node/esm --no-warnings=ExperimentalWarning lint/lint.ts",
"lint:fix": "node --loader=ts-node/esm --no-warnings=ExperimentalWarning lint/fix.ts",
"fix": "npm run format:fix && npm run lint:fix",
"stats": "node --loader=ts-node/esm --no-warnings=ExperimentalWarning scripts/statistics.ts",
"build": "node --loader=ts-node/esm --no-warnings=ExperimentalWarning scripts/build/index.ts",
Expand Down
2 changes: 1 addition & 1 deletion scripts/migrations/002-remove-webview-flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { fileURLToPath } from 'node:url';
import esMain from 'es-main';

import { CompatStatement, SimpleSupportStatement } from '../../types/types.js';
import { IS_WINDOWS } from '../../test/utils.js';
import { IS_WINDOWS } from '../../lint/utils.js';

const dirname = fileURLToPath(new URL('.', import.meta.url));

Expand Down
2 changes: 1 addition & 1 deletion scripts/migrations/010-set-oculus-to-mirror.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import esMain from 'es-main';

import { InternalSupportStatement } from '../../types/index.js';
import { CompatStatement } from '../../types/types.js';
import { IS_WINDOWS } from '../../test/utils.js';
import { IS_WINDOWS } from '../../lint/utils.js';

const dirname = fileURLToPath(new URL('.', import.meta.url));

Expand Down

0 comments on commit 4d6bfff

Please sign in to comment.