mirror of
https://github.com/django/django.git
synced 2024-11-21 10:59:04 +01:00
Migrated to ESLint 9+.
This commit is contained in:
parent
9a27c76021
commit
6345a6ff63
@ -1,7 +0,0 @@
|
|||||||
**/*.min.js
|
|
||||||
**/vendor/**/*.js
|
|
||||||
django/contrib/gis/templates/**/*.js
|
|
||||||
django/views/templates/*.js
|
|
||||||
docs/_build/**/*.js
|
|
||||||
node_modules/**.js
|
|
||||||
tests/**/*.js
|
|
37
.eslintrc
37
.eslintrc
@ -1,37 +0,0 @@
|
|||||||
{
|
|
||||||
"rules": {
|
|
||||||
"camelcase": ["off", {"properties": "always"}],
|
|
||||||
"comma-spacing": ["error", {"before": false, "after": true}],
|
|
||||||
"curly": ["error", "all"],
|
|
||||||
"dot-notation": ["error", {"allowKeywords": true}],
|
|
||||||
"eqeqeq": ["error"],
|
|
||||||
"indent": ["error", 4],
|
|
||||||
"key-spacing": ["error", {"beforeColon": false, "afterColon": true}],
|
|
||||||
"linebreak-style": ["error", "unix"],
|
|
||||||
"new-cap": ["off", {"newIsCap": true, "capIsNew": true}],
|
|
||||||
"no-alert": ["off"],
|
|
||||||
"no-eval": ["error"],
|
|
||||||
"no-extend-native": ["error", {"exceptions": ["Date", "String"]}],
|
|
||||||
"no-multi-spaces": ["error"],
|
|
||||||
"no-octal-escape": ["error"],
|
|
||||||
"no-script-url": ["error"],
|
|
||||||
"no-shadow": ["error", {"hoist": "functions"}],
|
|
||||||
"no-underscore-dangle": ["error"],
|
|
||||||
"no-unused-vars": ["error", {"vars": "local", "args": "none"}],
|
|
||||||
"no-var": ["error"],
|
|
||||||
"prefer-const": ["error"],
|
|
||||||
"quotes": ["off", "single"],
|
|
||||||
"semi": ["error", "always"],
|
|
||||||
"space-before-blocks": ["error", "always"],
|
|
||||||
"space-before-function-paren": ["error", {"anonymous": "never", "named": "never"}],
|
|
||||||
"space-infix-ops": ["error", {"int32Hint": false}],
|
|
||||||
"strict": ["error", "global"]
|
|
||||||
},
|
|
||||||
"env": {
|
|
||||||
"browser": true,
|
|
||||||
"es6": true
|
|
||||||
},
|
|
||||||
"globals": {
|
|
||||||
"django": false
|
|
||||||
}
|
|
||||||
}
|
|
@ -20,6 +20,6 @@ repos:
|
|||||||
hooks:
|
hooks:
|
||||||
- id: flake8
|
- id: flake8
|
||||||
- repo: https://github.com/pre-commit/mirrors-eslint
|
- repo: https://github.com/pre-commit/mirrors-eslint
|
||||||
rev: v8.56.0
|
rev: v9.2.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: eslint
|
- id: eslint
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/*global SelectBox, gettext, interpolate, quickElement, SelectFilter*/
|
/*global SelectBox, gettext, ngettext, interpolate, quickElement, SelectFilter*/
|
||||||
/*
|
/*
|
||||||
SelectFilter2 - Turns a multiple-select box into a filter interface.
|
SelectFilter2 - Turns a multiple-select box into a filter interface.
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/*global gettext, interpolate, ngettext*/
|
/*global gettext, interpolate, ngettext, Actions*/
|
||||||
'use strict';
|
'use strict';
|
||||||
{
|
{
|
||||||
function show(selector) {
|
function show(selector) {
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
/*global opener */
|
|
||||||
'use strict';
|
'use strict';
|
||||||
{
|
{
|
||||||
const initData = JSON.parse(document.getElementById('django-admin-popup-response-constants').dataset.popupResponse);
|
const initData = JSON.parse(document.getElementById('django-admin-popup-response-constants').dataset.popupResponse);
|
||||||
|
@ -54,7 +54,7 @@ class MapWidget {
|
|||||||
|
|
||||||
// Altering using user-provided options
|
// Altering using user-provided options
|
||||||
for (const property in options) {
|
for (const property in options) {
|
||||||
if (options.hasOwnProperty(property)) {
|
if (Object.hasOwn(options, property)) {
|
||||||
this.options[property] = options[property];
|
this.options[property] = options[property];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
63
eslint.config.mjs
Normal file
63
eslint.config.mjs
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
import globals from "globals";
|
||||||
|
import js from "@eslint/js";
|
||||||
|
|
||||||
|
export default [
|
||||||
|
js.configs.recommended,
|
||||||
|
{
|
||||||
|
files: ["**/*.js"],
|
||||||
|
rules: {
|
||||||
|
"camelcase": ["off", {"properties": "always"}],
|
||||||
|
"comma-spacing": ["error", {"before": false, "after": true}],
|
||||||
|
"curly": ["error", "all"],
|
||||||
|
"dot-notation": ["error", {"allowKeywords": true}],
|
||||||
|
"eqeqeq": ["error"],
|
||||||
|
"indent": ["error", 4],
|
||||||
|
"key-spacing": ["error", {"beforeColon": false, "afterColon": true}],
|
||||||
|
"linebreak-style": ["error", "unix"],
|
||||||
|
"new-cap": ["off", {"newIsCap": true, "capIsNew": true}],
|
||||||
|
"no-alert": ["off"],
|
||||||
|
"no-eval": ["error"],
|
||||||
|
"no-extend-native": ["error", {"exceptions": ["Date", "String"]}],
|
||||||
|
"no-multi-spaces": ["error"],
|
||||||
|
"no-octal-escape": ["error"],
|
||||||
|
"no-script-url": ["error"],
|
||||||
|
"no-shadow": ["error", {"hoist": "functions"}],
|
||||||
|
"no-underscore-dangle": ["error"],
|
||||||
|
"no-unused-vars": ["error", {"vars": "local", "args": "none"}],
|
||||||
|
"no-var": ["error"],
|
||||||
|
"prefer-const": ["error"],
|
||||||
|
"quotes": ["off", "single"],
|
||||||
|
"semi": ["error", "always"],
|
||||||
|
"space-before-blocks": ["error", "always"],
|
||||||
|
"space-before-function-paren": ["error", {"anonymous": "never", "named": "never"}],
|
||||||
|
"space-infix-ops": ["error", {"int32Hint": false}],
|
||||||
|
"strict": ["error", "global"]
|
||||||
|
},
|
||||||
|
languageOptions: {
|
||||||
|
ecmaVersion: 6,
|
||||||
|
sourceType: "script",
|
||||||
|
globals: {
|
||||||
|
...globals.browser,
|
||||||
|
...globals.commonjs,
|
||||||
|
"django": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
files: ["**/*.mjs"],
|
||||||
|
languageOptions: {
|
||||||
|
sourceType: "module"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
ignores: [
|
||||||
|
"**/*.min.js",
|
||||||
|
"**/vendor/**/*.js",
|
||||||
|
"django/contrib/gis/templates/**/*.js",
|
||||||
|
"django/views/templates/*.js",
|
||||||
|
"docs/_build/**/*.js",
|
||||||
|
"node_modules/**.js",
|
||||||
|
"tests/**/*.js",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
];
|
@ -1,4 +1,4 @@
|
|||||||
/* global QUnit */
|
/* global QUnit, Actions */
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
QUnit.module('admin.actions', {
|
QUnit.module('admin.actions', {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* global QUnit */
|
/* global QUnit, initSidebarQuickFilter */
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
QUnit.module('admin.sidebar: filter', {
|
QUnit.module('admin.sidebar: filter', {
|
||||||
|
@ -9,8 +9,9 @@
|
|||||||
"npm": ">=1.3.0"
|
"npm": ">=1.3.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"eslint": "^8.56.0",
|
"eslint": "^9.2.0",
|
||||||
"puppeteer": "^22.2.0",
|
"puppeteer": "^22.2.0",
|
||||||
|
"globals": "^15.1.0",
|
||||||
"grunt": "^1.6.1",
|
"grunt": "^1.6.1",
|
||||||
"grunt-cli": "^1.4.3",
|
"grunt-cli": "^1.4.3",
|
||||||
"grunt-contrib-qunit": "^8.0.1",
|
"grunt-contrib-qunit": "^8.0.1",
|
||||||
|
Loading…
Reference in New Issue
Block a user