Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
102 changes: 0 additions & 102 deletions .github/linters/.eslintrc.yml

This file was deleted.

98 changes: 98 additions & 0 deletions .github/linters/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
import { defineConfig, globalIgnores } from "eslint/config";
import js from "@eslint/js";
import globals from "globals";
import n from "eslint-plugin-n";
import prettier from "eslint-plugin-prettier";
import eslintPluginJsonc from "eslint-plugin-jsonc";

export default defineConfig([
globalIgnores(["!**/.*", "**/node_modules/.*", "dist/third-parties.js"]),

// Base configuration: ESLint recommended, Node plugin, and Prettier integration
{
plugins: {
n,
prettier,
},
rules: {
...js.configs.recommended.rules,
"no-inner-declarations": "off",
"no-unused-vars": [
"error",
{
caughtErrors: "none",
},
],
},
},

// JSON files
...eslintPluginJsonc.configs["recommended-with-json"].map((config) => ({
...config,
files: ["**/*.json"],
})),

// Custom metrics (Browser / WebPageTest context)
{
files: ["dist/**/*.js", "inject-dist/**/*.js"],
languageOptions: {
ecmaVersion: "latest",
sourceType: "script",
parserOptions: {
ecmaFeatures: {
globalReturn: true,
},
},
globals: {
...globals.browser,
$WPT_ACCESSIBILITY_TREE: "readonly",
$WPT_BODIES: "readonly",
$WPT_COOKIES: "readonly",
$WPT_DNS: "readonly",
$WPT_REQUESTS: "readonly",
$WPT_TEST_URL: "readonly",
httparchive_enable_observations: "writable",
__REACT_DEVTOOLS_GLOBAL_HOOK__: "writable",
CSSUnparsedValue: "readonly",
LaunchParams: "readonly",
},
},
},

// CLI and tooling scripts (Node.js context)
{
files: ["bin/**/*.js"],
languageOptions: {
ecmaVersion: "latest",
sourceType: "commonjs",
globals: {
...globals.node,
},
},
},

// Tests (Node.js + Jest context)
{
files: ["tests/**/*.js"],
languageOptions: {
ecmaVersion: "latest",
sourceType: "commonjs",
globals: {
...globals.node,
...globals.jest,
},
},
},

// Root configuration files (ESM context)
{
files: ["*.mjs", ".github/**/*.mjs"],
languageOptions: {
ecmaVersion: "latest",
sourceType: "module",
globals: {
...globals.node,
},
},
},
]);
9 changes: 7 additions & 2 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ jobs:
name: Lint Code Base
# Set the agent to run on
runs-on: ubuntu-latest
permissions:
contents: read
statuses: write

##################
# Load all steps #
Expand All @@ -51,8 +54,9 @@ jobs:
- name: Set VALIDATE_ALL_CODEBASE variable to false
# Only run the full workflow for manual runs or if upgrading the super linter
if: |
github.event_name != 'workflow_dispatch' &&
startsWith(github.event.pull_request.title,'Bump github/super-linter') != true
github.event_name != 'workflow_dispatch' &&
!contains(github.event.pull_request.title, 'super-linter') &&
!contains(github.event.pull_request.body, 'super-linter')
run: |
echo "VALIDATE_ALL_CODEBASE=false" >> $GITHUB_ENV

Expand All @@ -64,6 +68,7 @@ jobs:
env:
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ENABLE_GITHUB_PULL_REQUEST_SUMMARY_COMMENT: false
VALIDATE_JAVASCRIPT_ES: true
VALIDATE_EDITORCONFIG: true
VALIDATE_MARKDOWN: true
Expand Down
Loading