Skip to content

Commit 6345a6f

Browse files
felixxmsarahboyce
authored andcommitted
Migrated to ESLint 9+.
1 parent 9a27c76 commit 6345a6f

File tree

11 files changed

+71
-52
lines changed

11 files changed

+71
-52
lines changed

.eslintignore

-7
This file was deleted.

.eslintrc

-37
This file was deleted.

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ repos:
2020
hooks:
2121
- id: flake8
2222
- repo: https://github.com/pre-commit/mirrors-eslint
23-
rev: v8.56.0
23+
rev: v9.2.0
2424
hooks:
2525
- id: eslint

django/contrib/admin/static/admin/js/SelectFilter2.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*global SelectBox, gettext, interpolate, quickElement, SelectFilter*/
1+
/*global SelectBox, gettext, ngettext, interpolate, quickElement, SelectFilter*/
22
/*
33
SelectFilter2 - Turns a multiple-select box into a filter interface.
44

django/contrib/admin/static/admin/js/actions.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*global gettext, interpolate, ngettext*/
1+
/*global gettext, interpolate, ngettext, Actions*/
22
'use strict';
33
{
44
function show(selector) {

django/contrib/admin/static/admin/js/popup_response.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/*global opener */
21
'use strict';
32
{
43
const initData = JSON.parse(document.getElementById('django-admin-popup-response-constants').dataset.popupResponse);

django/contrib/gis/static/gis/js/OLMapWidget.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class MapWidget {
5454

5555
// Altering using user-provided options
5656
for (const property in options) {
57-
if (options.hasOwnProperty(property)) {
57+
if (Object.hasOwn(options, property)) {
5858
this.options[property] = options[property];
5959
}
6060
}

eslint.config.mjs

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
import globals from "globals";
2+
import js from "@eslint/js";
3+
4+
export default [
5+
js.configs.recommended,
6+
{
7+
files: ["**/*.js"],
8+
rules: {
9+
"camelcase": ["off", {"properties": "always"}],
10+
"comma-spacing": ["error", {"before": false, "after": true}],
11+
"curly": ["error", "all"],
12+
"dot-notation": ["error", {"allowKeywords": true}],
13+
"eqeqeq": ["error"],
14+
"indent": ["error", 4],
15+
"key-spacing": ["error", {"beforeColon": false, "afterColon": true}],
16+
"linebreak-style": ["error", "unix"],
17+
"new-cap": ["off", {"newIsCap": true, "capIsNew": true}],
18+
"no-alert": ["off"],
19+
"no-eval": ["error"],
20+
"no-extend-native": ["error", {"exceptions": ["Date", "String"]}],
21+
"no-multi-spaces": ["error"],
22+
"no-octal-escape": ["error"],
23+
"no-script-url": ["error"],
24+
"no-shadow": ["error", {"hoist": "functions"}],
25+
"no-underscore-dangle": ["error"],
26+
"no-unused-vars": ["error", {"vars": "local", "args": "none"}],
27+
"no-var": ["error"],
28+
"prefer-const": ["error"],
29+
"quotes": ["off", "single"],
30+
"semi": ["error", "always"],
31+
"space-before-blocks": ["error", "always"],
32+
"space-before-function-paren": ["error", {"anonymous": "never", "named": "never"}],
33+
"space-infix-ops": ["error", {"int32Hint": false}],
34+
"strict": ["error", "global"]
35+
},
36+
languageOptions: {
37+
ecmaVersion: 6,
38+
sourceType: "script",
39+
globals: {
40+
...globals.browser,
41+
...globals.commonjs,
42+
"django": false
43+
}
44+
}
45+
},
46+
{
47+
files: ["**/*.mjs"],
48+
languageOptions: {
49+
sourceType: "module"
50+
}
51+
},
52+
{
53+
ignores: [
54+
"**/*.min.js",
55+
"**/vendor/**/*.js",
56+
"django/contrib/gis/templates/**/*.js",
57+
"django/views/templates/*.js",
58+
"docs/_build/**/*.js",
59+
"node_modules/**.js",
60+
"tests/**/*.js",
61+
]
62+
}
63+
];

js_tests/admin/actions.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* global QUnit */
1+
/* global QUnit, Actions */
22
'use strict';
33

44
QUnit.module('admin.actions', {

js_tests/admin/navigation.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* global QUnit */
1+
/* global QUnit, initSidebarQuickFilter */
22
'use strict';
33

44
QUnit.module('admin.sidebar: filter', {

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99
"npm": ">=1.3.0"
1010
},
1111
"devDependencies": {
12-
"eslint": "^8.56.0",
12+
"eslint": "^9.2.0",
1313
"puppeteer": "^22.2.0",
14+
"globals": "^15.1.0",
1415
"grunt": "^1.6.1",
1516
"grunt-cli": "^1.4.3",
1617
"grunt-contrib-qunit": "^8.0.1",

0 commit comments

Comments
 (0)