Merge pull request #244 from return42/eslint-simple-client

[mod] simple theme - add ESLint
This commit is contained in:
Alexandre Flament 2021-08-31 13:24:06 +02:00 committed by GitHub
commit 66a27757fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 31 additions and 8 deletions

View File

@ -91,9 +91,9 @@
(js-mode (js-mode
. ((eval . (progn . ((eval . (progn
(setq-local js-indent-level 2) (setq-local js-indent-level 2)
;; flycheck should use the jshint checker from simple theme ;; flycheck should use the eslint checker from simple theme
(setq-local flycheck-javascript-jshint-executable (setq-local flycheck-javascript-eslint-executable
(expand-file-name "searx/static/themes/simple/node_modules/.bin/jshint" prj-root)) (expand-file-name "searx/static/themes/simple/node_modules/.bin/eslint" prj-root))
(flycheck-mode) (flycheck-mode)
)))) ))))

View File

@ -0,0 +1,12 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 12
},
"rules": {
}
}

View File

@ -9,11 +9,19 @@ module.exports = function(grunt) {
watch: { watch: {
scripts: { scripts: {
files: ['src/**'], files: ['src/**'],
tasks: ['jshint', 'copy', 'concat', 'uglify', 'less:development', 'less:production'] tasks: ['eslint', 'copy', 'concat', 'uglify', 'less:development', 'less:production']
} }
}, },
jshint: { eslint: {
files: ['src/js/main/*.js', 'src/js/head/*.js', '../__common__/js/*.js'], options: {
configFile: '.eslintrc.json',
failOnError: false
},
target: [
'src/js/main/*.js',
'src/js/head/*.js',
'../__common__/js/*.js'
],
}, },
stylelint: { stylelint: {
options: { options: {
@ -189,11 +197,12 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-cssmin'); grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-webfont'); grunt.loadNpmTasks('grunt-webfont');
grunt.loadNpmTasks('grunt-stylelint'); grunt.loadNpmTasks('grunt-stylelint');
grunt.loadNpmTasks('grunt-eslint');
grunt.registerTask('test', ['jshint']); grunt.registerTask('test', ['jshint']);
grunt.registerTask('default', [ grunt.registerTask('default', [
'jshint', 'eslint',
'stylelint', 'stylelint',
'copy', 'copy',
'concat', 'concat',

View File

@ -10,9 +10,10 @@
"grunt-contrib-uglify": "~5.0.1", "grunt-contrib-uglify": "~5.0.1",
"grunt-contrib-watch": "~1.1.0", "grunt-contrib-watch": "~1.1.0",
"grunt-stylelint": "^0.16.0", "grunt-stylelint": "^0.16.0",
"grunt-eslint": "^23.0.0",
"grunt-webfont": "^1.7.2", "grunt-webfont": "^1.7.2",
"ionicons-npm": "^2.0.1", "ionicons-npm": "^2.0.1",
"jslint": "^0.12.1", "eslint": "^7.32.0",
"less": "^4.1.1", "less": "^4.1.1",
"less-plugin-clean-css": "^1.5.1", "less-plugin-clean-css": "^1.5.1",
"stylelint": "^13.13.1", "stylelint": "^13.13.1",
@ -26,6 +27,7 @@
"scripts": { "scripts": {
"all": "npm install && grunt", "all": "npm install && grunt",
"build": "grunt", "build": "grunt",
"eslint": "grunt eslint",
"watch": "grunt watch", "watch": "grunt watch",
"webfont": "grunt webfont", "webfont": "grunt webfont",
"clean": "rm -Rf node_modules package-lock.json ion.less", "clean": "rm -Rf node_modules package-lock.json ion.less",