Skip to content

Commit

Permalink
Better integrate latest eslint version
Browse files Browse the repository at this point in the history
  • Loading branch information
gorhill committed Jan 10, 2025
1 parent 4b12247 commit f8975e3
Show file tree
Hide file tree
Showing 112 changed files with 1,617 additions and 880 deletions.
30 changes: 0 additions & 30 deletions .eslintrc.yml

This file was deleted.

22 changes: 0 additions & 22 deletions .jshintrc

This file was deleted.

7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@ firefox: dist/build/uBlock0.firefox
dist/build/uBlock0.npm: tools/make-nodejs.sh $(sources) $(platform) $(assets)
tools/make-npm.sh

# Build the Node.js package.
npm: dist/build/uBlock0.npm
# Dev tools
npm: node_modules/
npm install

lint: npm
cd dist/build/uBlock0.npm && npm run lint
npm run lint

test: npm
cd dist/build/uBlock0.npm && npm run test
Expand Down
51 changes: 51 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import js from "@eslint/js";
import globals from "globals";
import json from "@eslint/json";

import { includeIgnoreFile } from "@eslint/compat";
import path from "node:path";
import { fileURLToPath } from "node:url";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const gitignorePath = path.resolve(__dirname, ".gitignore");

export default [ includeIgnoreFile(gitignorePath), {
files: ["**/*.js", "**/*.mjs"],
...js.configs.recommended,
}, {
files: ["**/*.js", "**/*.mjs"],
languageOptions: {
globals: {
...globals.browser,
browser: "readonly",
chrome: "readonly",
vAPI: "readonly",
},
sourceType: "module",
},
rules: {
eqeqeq: ["warn", "always"],
indent: ["error", 4, {
ignoredNodes: [
"Program > BlockStatement",
"Program > ExpressionStatement > CallExpression > ArrowFunctionExpression > BlockStatement",
"Program > ExpressionStatement > CallExpression > FunctionExpression > BlockStatement",
"Program > IfStatement > BlockStatement",
"Program > VariableDeclaration > VariableDeclarator > CallExpression > ArrowFunctionExpression > BlockStatement",
"CallExpression > MemberExpression",
"ArrayExpression > *",
"ObjectExpression > *",
],
}],
"no-control-regex": "off",
"no-empty": "off",
"sort-imports": "error",
"strict": "error",
},
}, {
files: ["**/*.json"],
ignores: ["package-lock.json"],
language: "json/json",
...json.configs.recommended,
} ];
Loading

0 comments on commit f8975e3

Please sign in to comment.