mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
Consolidates the root .eslintrc.json and five nested configs (build, script, docs, default_app, spec) into a single .oxlintrc.json at the repo root. script/lint.js now shells out to the oxlint binary from node_modules/.bin instead of using the ESLint Node API, and emits GitHub Actions annotations directly via --format=github in CI (replacing the deleted eslint-stylish problem matcher). Oxlint has no markdown processor, so the ESLint-based lint of JS code blocks in docs/**/*.md is replaced with an inline regex check for bare Node.js builtin imports. This preserves the rule docs/.eslintrc.json was originally added for in #42113; the rest of the standard ruleset on docs code blocks was already being enforced in parallel by lint-roller-markdown-standard.
330 lines
7.4 KiB
JSON
330 lines
7.4 KiB
JSON
{
|
|
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
|
"plugins": [
|
|
"typescript",
|
|
"import",
|
|
"node",
|
|
"promise",
|
|
"unicorn"
|
|
],
|
|
"jsPlugins": [
|
|
{
|
|
"name": "no-only-tests",
|
|
"specifier": "./script/lint-plugins/no-only-tests.mjs"
|
|
}
|
|
],
|
|
"categories": {
|
|
"correctness": "off"
|
|
},
|
|
"options": {
|
|
"typeAware": false
|
|
},
|
|
"env": {
|
|
"builtin": true,
|
|
"browser": true
|
|
},
|
|
"ignorePatterns": [
|
|
".github/workflows/node_modules",
|
|
"spec/node_modules",
|
|
"spec/fixtures/native-addon",
|
|
"shell/browser/resources/win/resource.h",
|
|
"shell/common/node_includes.h",
|
|
"spec/fixtures/pages/jquery-3.6.0.min.js"
|
|
],
|
|
"rules": {
|
|
"no-var": "error",
|
|
"accessor-pairs": [
|
|
"error",
|
|
{
|
|
"setWithoutGet": true,
|
|
"enforceForClassMembers": true
|
|
}
|
|
],
|
|
"array-callback-return": [
|
|
"error",
|
|
{
|
|
"allowImplicit": false,
|
|
"checkForEach": false
|
|
}
|
|
],
|
|
"constructor-super": "error",
|
|
"curly": [
|
|
"error",
|
|
"multi-line"
|
|
],
|
|
"default-case-last": "error",
|
|
"eqeqeq": [
|
|
"error",
|
|
"always",
|
|
{
|
|
"null": "ignore"
|
|
}
|
|
],
|
|
"new-cap": [
|
|
"error",
|
|
{
|
|
"newIsCap": true,
|
|
"capIsNew": false,
|
|
"properties": true
|
|
}
|
|
],
|
|
"no-array-constructor": "error",
|
|
"no-async-promise-executor": "error",
|
|
"no-caller": "error",
|
|
"no-case-declarations": "error",
|
|
"no-class-assign": "error",
|
|
"no-compare-neg-zero": "error",
|
|
"no-cond-assign": "error",
|
|
"no-const-assign": "error",
|
|
"no-constant-condition": [
|
|
"error",
|
|
{
|
|
"checkLoops": false
|
|
}
|
|
],
|
|
"no-control-regex": "error",
|
|
"no-debugger": "error",
|
|
"no-delete-var": "error",
|
|
"no-dupe-class-members": "error",
|
|
"no-dupe-keys": "error",
|
|
"no-duplicate-case": "error",
|
|
"no-useless-backreference": "error",
|
|
"no-empty": [
|
|
"error",
|
|
{
|
|
"allowEmptyCatch": true
|
|
}
|
|
],
|
|
"no-empty-character-class": "error",
|
|
"no-empty-pattern": "error",
|
|
"no-eval": "error",
|
|
"no-ex-assign": "error",
|
|
"no-extend-native": "error",
|
|
"no-extra-bind": "error",
|
|
"no-extra-boolean-cast": "error",
|
|
"no-fallthrough": "error",
|
|
"no-func-assign": "error",
|
|
"no-global-assign": "error",
|
|
"no-import-assign": "error",
|
|
"no-invalid-regexp": "error",
|
|
"no-irregular-whitespace": "error",
|
|
"no-iterator": "error",
|
|
"no-labels": [
|
|
"error",
|
|
{
|
|
"allowLoop": false,
|
|
"allowSwitch": false
|
|
}
|
|
],
|
|
"no-lone-blocks": "error",
|
|
"no-loss-of-precision": "error",
|
|
"no-misleading-character-class": "error",
|
|
"no-prototype-builtins": "error",
|
|
"no-useless-catch": "error",
|
|
"no-useless-constructor": "error",
|
|
"no-use-before-define": [
|
|
"error",
|
|
{
|
|
"functions": false,
|
|
"classes": false,
|
|
"variables": false
|
|
}
|
|
],
|
|
"no-multi-str": "error",
|
|
"no-new": "error",
|
|
"no-new-func": "error",
|
|
"no-new-wrappers": "error",
|
|
"no-obj-calls": "error",
|
|
"no-proto": "error",
|
|
"no-redeclare": [
|
|
"error"
|
|
],
|
|
"no-regex-spaces": "error",
|
|
"no-return-assign": [
|
|
"error",
|
|
"except-parens"
|
|
],
|
|
"no-self-assign": [
|
|
"error",
|
|
{
|
|
"props": true
|
|
}
|
|
],
|
|
"no-self-compare": "error",
|
|
"no-sequences": "error",
|
|
"no-shadow-restricted-names": "error",
|
|
"no-sparse-arrays": "error",
|
|
"no-template-curly-in-string": "error",
|
|
"no-this-before-super": "error",
|
|
"no-throw-literal": "error",
|
|
"no-unexpected-multiline": "error",
|
|
"no-unmodified-loop-condition": "error",
|
|
"no-unneeded-ternary": [
|
|
"error",
|
|
{
|
|
"defaultAssignment": false
|
|
}
|
|
],
|
|
"no-unreachable": "error",
|
|
"no-unsafe-finally": "error",
|
|
"no-unsafe-negation": "error",
|
|
"no-unused-vars": [
|
|
"error",
|
|
{
|
|
"vars": "all",
|
|
"args": "after-used",
|
|
"argsIgnorePattern": "^_",
|
|
"ignoreRestSiblings": true
|
|
}
|
|
],
|
|
"no-useless-call": "error",
|
|
"no-useless-computed-key": "error",
|
|
"no-useless-escape": "error",
|
|
"no-useless-rename": "error",
|
|
"no-useless-return": "error",
|
|
"no-void": "error",
|
|
"no-with": "error",
|
|
"prefer-const": [
|
|
"error",
|
|
{
|
|
"destructuring": "all"
|
|
}
|
|
],
|
|
"prefer-promise-reject-errors": "error",
|
|
"symbol-description": "error",
|
|
"unicode-bom": [
|
|
"error",
|
|
"never"
|
|
],
|
|
"use-isnan": [
|
|
"error",
|
|
{
|
|
"enforceForSwitchCase": true,
|
|
"enforceForIndexOf": true
|
|
}
|
|
],
|
|
"valid-typeof": [
|
|
"error",
|
|
{
|
|
"requireStringLiterals": true
|
|
}
|
|
],
|
|
"yoda": [
|
|
"error",
|
|
"never"
|
|
],
|
|
"import/export": "error",
|
|
"import/first": "error",
|
|
"import/no-absolute-path": [
|
|
"error",
|
|
{
|
|
"esmodule": true,
|
|
"commonjs": true,
|
|
"amd": false
|
|
}
|
|
],
|
|
"import/no-duplicates": "error",
|
|
"import/no-named-default": "error",
|
|
"import/no-webpack-loader-syntax": "error",
|
|
"promise/param-names": "error",
|
|
"guard-for-in": "error",
|
|
"node/handle-callback-err": [
|
|
"error",
|
|
"^(err|error)$"
|
|
],
|
|
"node/no-exports-assign": "error",
|
|
"node/no-new-require": "error",
|
|
"node/no-path-concat": "error"
|
|
},
|
|
"overrides": [
|
|
{
|
|
"files": ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts"],
|
|
"rules": {
|
|
"no-use-before-define": "off"
|
|
}
|
|
},
|
|
{
|
|
"files": ["lib/browser/**", "lib/utility/**"],
|
|
"rules": {
|
|
"no-restricted-imports": [
|
|
"error",
|
|
{
|
|
"paths": ["electron", "electron/renderer"],
|
|
"patterns": [
|
|
"./*",
|
|
"../*",
|
|
"@electron/internal/isolated_renderer/*",
|
|
"@electron/internal/renderer/*",
|
|
"@electron/internal/sandboxed_worker/*",
|
|
"@electron/internal/worker/*"
|
|
]
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"files": [
|
|
"lib/renderer/**",
|
|
"lib/worker/**",
|
|
"lib/preload_realm/**",
|
|
"lib/sandboxed_renderer/**",
|
|
"lib/isolated_renderer/**"
|
|
],
|
|
"rules": {
|
|
"no-restricted-imports": [
|
|
"error",
|
|
{
|
|
"paths": ["electron", "electron/main"],
|
|
"patterns": ["./*", "../*", "@electron/internal/browser/*"]
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"files": ["lib/common/**"],
|
|
"rules": {
|
|
"no-restricted-imports": [
|
|
"error",
|
|
{
|
|
"paths": ["electron", "electron/main", "electron/renderer"],
|
|
"patterns": [
|
|
"./*",
|
|
"../*",
|
|
"@electron/internal/browser/*",
|
|
"@electron/internal/isolated_renderer/*",
|
|
"@electron/internal/renderer/*",
|
|
"@electron/internal/sandboxed_worker/*",
|
|
"@electron/internal/worker/*"
|
|
]
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"files": [
|
|
"build/**",
|
|
"script/**",
|
|
"docs/**",
|
|
"default_app/**",
|
|
"spec/**"
|
|
],
|
|
"rules": {
|
|
"unicorn/prefer-node-protocol": "error"
|
|
}
|
|
},
|
|
{
|
|
"files": ["spec/**/*.ts", "spec/**/*.js", "spec/**/*.mjs"],
|
|
"rules": {
|
|
"no-only-tests/no-only-tests": "error"
|
|
}
|
|
},
|
|
{
|
|
"files": ["**/*.d.ts"],
|
|
"rules": {
|
|
"no-useless-constructor": "off",
|
|
"no-unused-vars": "off"
|
|
}
|
|
}
|
|
]
|
|
}
|