1
0
mirror of https://github.com/django/django.git synced 2025-04-04 13:36:42 +00:00

qa with eslint for js files modified during bug fix, eslint reported errors all fixed

This commit is contained in:
Alanna Cao 2024-12-08 18:24:36 -05:00
parent 7a4bd305fd
commit 7af335597b
3 changed files with 16 additions and 62 deletions

View File

@ -169,7 +169,7 @@ Requires core.js and SelectBox.js.
clear_all.addEventListener('click', function(e) {
move_selection(e, this, SelectBox.move_all, field_id + '_to', field_id + '_from');
});
warning_footer.addEventListener('click', function(e) {
warning_footer.addEventListener('click', function() {
filter_selected_input.value = '';
SelectBox.filter(field_id + '_to', '');
SelectFilter.refresh_filtered_warning(field_id);
@ -318,7 +318,7 @@ Requires core.js and SelectBox.js.
}
};
window.addEventListener('load', function(e) {
window.addEventListener('load', function() {
document.querySelectorAll('select.selectfilter, select.selectfilterstacked').forEach(function(el) {
const data = el.dataset;
SelectFilter.init(el.id, data.fieldName, parseInt(data.isStacked, 10));

View File

@ -174,7 +174,7 @@
}
};
$this.each(function(i) {
$this.each(function() {
$(this).not("." + options.emptyCssClass).addClass(options.formCssClass);
});
@ -276,7 +276,7 @@
// Stacked inlines ---------------------------------------------------------
$.fn.stackedFormset = function(selector, options) {
const $rows = $(this);
const updateInlineLabel = function(row) {
const updateInlineLabel = function() {
$(selector).find(".inline_label").each(function(i) {
const count = i + 1;
$(this).html($(this).html().replace(/(#\d+)/g, "#" + count));

View File

@ -1,63 +1,17 @@
import globals from "globals";
import js from "@eslint/js";
import pluginJs from "@eslint/js";
/** @type {import('eslint').Linter.Config[]} */
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
}
}
// Include browser globals (e.g., window, document) and node globals if needed
{
languageOptions: {
globals: {
...globals.browser, // Adds browser-specific globals like window, document
django: "readonly", // Declares django as a global variable
updateSelectFilter: "readonly", // Declares updateSelectFilter as a global variable
},
},
{
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",
]
}
},
pluginJs.configs.recommended, // Use recommended JavaScript rules
];