Replace jshint by eslint
Closes #13087 (grafted from b2a2c9483562f6ae5430df5cc957148003ac3520) --HG-- branch : 7.0
This commit is contained in:
@@ -125,6 +125,21 @@ check-dist:
|
||||
script:
|
||||
- twine check packages/*
|
||||
|
||||
check-eslint:
|
||||
extends: .check
|
||||
image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/node
|
||||
variables:
|
||||
NODE_CACHE_DIR: "$CI_PROJECT_DIR/.cache/npm"
|
||||
cache:
|
||||
paths:
|
||||
- .cache/npm
|
||||
before_script:
|
||||
- sh .gitlab-scripts/bower_allow_root.sh
|
||||
script:
|
||||
- cd sao
|
||||
- npm install --cache ${NODE_CACHE_DIR} --unsafe-perm --legacy-peer-deps
|
||||
- npm run check
|
||||
|
||||
check-ci-modules:
|
||||
extends: .check
|
||||
script:
|
||||
|
||||
+4
-22
@@ -75,23 +75,6 @@ module.exports = function(grunt) {
|
||||
dest: 'dist/<%= pkg.name %>.js'
|
||||
}
|
||||
},
|
||||
jshint: {
|
||||
dist: {
|
||||
options: {
|
||||
jshintrc: 'src/.jshintrc'
|
||||
},
|
||||
src: ['dist/<%= pkg.name %>.js']
|
||||
},
|
||||
grunt: {
|
||||
src: ['Gruntfile.js']
|
||||
},
|
||||
tests: {
|
||||
options: {
|
||||
jshintrc: 'tests/.jshintrc'
|
||||
},
|
||||
src: ['tests/*.js']
|
||||
}
|
||||
},
|
||||
uglify: {
|
||||
options: {
|
||||
banner: '/*! <%= pkg.name %>-<%= pkg.version %> | GPL-3\n' +
|
||||
@@ -127,7 +110,7 @@ module.exports = function(grunt) {
|
||||
watch: {
|
||||
scripts: {
|
||||
files: ['src/**/*.js'],
|
||||
tasks: ['concat', 'jshint']
|
||||
tasks: ['concat']
|
||||
},
|
||||
styles: {
|
||||
files: ['src/*.less'],
|
||||
@@ -152,17 +135,16 @@ module.exports = function(grunt) {
|
||||
});
|
||||
|
||||
grunt.loadNpmTasks('grunt-contrib-concat');
|
||||
grunt.loadNpmTasks('grunt-contrib-jshint');
|
||||
grunt.loadNpmTasks('grunt-contrib-uglify');
|
||||
grunt.loadNpmTasks('grunt-contrib-less');
|
||||
grunt.loadNpmTasks('grunt-po2json');
|
||||
grunt.loadNpmTasks('grunt-qunit-junit');
|
||||
|
||||
grunt.registerTask('default', 'Build for production.', function() {
|
||||
grunt.task.run(['concat', 'jshint', 'uglify', 'less', 'po2json']);
|
||||
grunt.task.run(['concat', 'uglify', 'less', 'po2json']);
|
||||
});
|
||||
grunt.registerTask('dev', 'Build for development.', function() {
|
||||
grunt.task.run(['concat', 'jshint', 'less:dev']);
|
||||
grunt.task.run(['concat', 'less:dev']);
|
||||
});
|
||||
grunt.registerTask('devwatch', 'Watch development', function() {
|
||||
grunt.loadNpmTasks('grunt-contrib-watch');
|
||||
@@ -178,7 +160,7 @@ module.exports = function(grunt) {
|
||||
});
|
||||
grunt.registerTask('test', 'Run tests', function() {
|
||||
grunt.loadNpmTasks('grunt-contrib-qunit');
|
||||
grunt.task.run(['concat', 'jshint', 'less:dev', 'qunit_junit', 'qunit']);
|
||||
grunt.task.run(['concat', 'less:dev', 'qunit_junit', 'qunit']);
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
import js from "@eslint/js";
|
||||
import globals from "globals";
|
||||
|
||||
export default [
|
||||
js.configs.recommended,
|
||||
{
|
||||
languageOptions: {
|
||||
ecmaVersion: 6,
|
||||
sourceType: "script",
|
||||
globals: {
|
||||
Mousetrap: "readonly",
|
||||
Papa: "readonly",
|
||||
QUnit: "readonly",
|
||||
Sao: "readonly",
|
||||
Sortable: "readonly",
|
||||
c3: "readonly",
|
||||
i18n: "readonly",
|
||||
jQuery: "readonly",
|
||||
moment: "readonly",
|
||||
...globals.browser
|
||||
},
|
||||
},
|
||||
rules: {
|
||||
"getter-return": "off",
|
||||
"no-constant-condition": "off",
|
||||
"no-empty": "off",
|
||||
"no-extra-boolean-cast": "off",
|
||||
"no-prototype-builtins": "off",
|
||||
"no-self-assign": "off",
|
||||
"no-unexpected-multiline": "off",
|
||||
"no-unused-vars": "off",
|
||||
"no-useless-escape": "off",
|
||||
"no-with": "off",
|
||||
},
|
||||
}, {
|
||||
files: ['tests/**/*.js'],
|
||||
languageOptions: {
|
||||
globals: {
|
||||
Sao: "readonly",
|
||||
eval_pyson: "readonly",
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
+3
-1
@@ -34,9 +34,12 @@
|
||||
],
|
||||
"scripts": {
|
||||
"test": "npx grunt test -v",
|
||||
"check": "npx eslint src tests",
|
||||
"postinstall": "npx bower install"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^8.57.0",
|
||||
"globals": "^14.0.0",
|
||||
"grunt-contrib-nodeunit": "^2.0",
|
||||
"grunt-contrib-qunit": "^3.1",
|
||||
"grunt-contrib-watch": "^1.1",
|
||||
@@ -52,7 +55,6 @@
|
||||
"grunt": "^1.0",
|
||||
"grunt-cli": "^1.3",
|
||||
"grunt-contrib-concat": "^1.0",
|
||||
"grunt-contrib-jshint": "^2.1",
|
||||
"grunt-contrib-less": "^2.0",
|
||||
"grunt-contrib-uglify": "^5.0"
|
||||
}
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"browser": true,
|
||||
"devel": true,
|
||||
"esversion": 6,
|
||||
"jquery": true
|
||||
}
|
||||
+5
-2
@@ -1,8 +1,11 @@
|
||||
/* This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. */
|
||||
|
||||
/* eslint-disable no-redeclare */
|
||||
var Sao = {
|
||||
__version__: '7.0.9',
|
||||
};
|
||||
/* eslint-enable no-redeclare */
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
@@ -1201,7 +1204,7 @@ var Sao = {
|
||||
if (definition.id){
|
||||
var current_tab = Sao.Tab.tabs.get_current();
|
||||
if (current_tab) {
|
||||
var focused = $(':focus');
|
||||
var focused = jQuery(':focus');
|
||||
focused.blur();
|
||||
current_tab.el.find('a[id="' + definition.id + '"]').click();
|
||||
focused.focus();
|
||||
@@ -1283,7 +1286,7 @@ var Sao = {
|
||||
.on('hidden.bs.modal', '.modal', function(event) {
|
||||
setModalsAndBackdropsOrder();
|
||||
if (jQuery('.modal:visible').length) {
|
||||
$(document.body).addClass('modal-open');
|
||||
jQuery(document.body).addClass('modal-open');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
/* This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. */
|
||||
|
||||
/* jshint ignore:start */
|
||||
// Must be defined in non strict context otherwise is invalid
|
||||
function eval_pyson(value){
|
||||
with (Sao.PYSON.eval) {
|
||||
@@ -9,7 +8,6 @@ function eval_pyson(value){
|
||||
return eval('(' + value + ')');
|
||||
}
|
||||
}
|
||||
/* jshint ignore:end */
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"browser": true,
|
||||
"esversion": 6,
|
||||
"jquery": true,
|
||||
"predef": [
|
||||
"QUnit",
|
||||
"Sao"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user