mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	Introduce eslint-plugin-jquery (#19690)
Introduce the plugin that allows us to gradually forbid jQuery code. I've enabled all rules that already pass. Next step will be to go through each rule and fix the issues by using native DOM equivalents, which I think can be done in separate PRs, but if prefered I could also start here.
This commit is contained in:
		
							
								
								
									
										50
									
								
								.eslintrc
									
									
									
									
									
								
							
							
						
						
									
										50
									
								
								.eslintrc
									
									
									
									
									
								
							@@ -13,6 +13,7 @@ plugins:
 | 
				
			|||||||
  - eslint-plugin-import
 | 
					  - eslint-plugin-import
 | 
				
			||||||
  - eslint-plugin-vue
 | 
					  - eslint-plugin-vue
 | 
				
			||||||
  - eslint-plugin-html
 | 
					  - eslint-plugin-html
 | 
				
			||||||
 | 
					  - eslint-plugin-jquery
 | 
				
			||||||
 | 
					
 | 
				
			||||||
extends:
 | 
					extends:
 | 
				
			||||||
  - plugin:vue/recommended
 | 
					  - plugin:vue/recommended
 | 
				
			||||||
@@ -140,6 +141,55 @@ rules:
 | 
				
			|||||||
  import/unambiguous: [0]
 | 
					  import/unambiguous: [0]
 | 
				
			||||||
  indent: [2, 2, {SwitchCase: 1}]
 | 
					  indent: [2, 2, {SwitchCase: 1}]
 | 
				
			||||||
  init-declarations: [0]
 | 
					  init-declarations: [0]
 | 
				
			||||||
 | 
					  jquery/no-ajax-events: [2]
 | 
				
			||||||
 | 
					  jquery/no-ajax: [0]
 | 
				
			||||||
 | 
					  jquery/no-animate: [2]
 | 
				
			||||||
 | 
					  jquery/no-attr: [0]
 | 
				
			||||||
 | 
					  jquery/no-bind: [2]
 | 
				
			||||||
 | 
					  jquery/no-class: [0]
 | 
				
			||||||
 | 
					  jquery/no-clone: [2]
 | 
				
			||||||
 | 
					  jquery/no-closest: [0]
 | 
				
			||||||
 | 
					  jquery/no-css: [0]
 | 
				
			||||||
 | 
					  jquery/no-data: [0]
 | 
				
			||||||
 | 
					  jquery/no-deferred: [2]
 | 
				
			||||||
 | 
					  jquery/no-delegate: [2]
 | 
				
			||||||
 | 
					  jquery/no-each: [0]
 | 
				
			||||||
 | 
					  jquery/no-extend: [2]
 | 
				
			||||||
 | 
					  jquery/no-fade: [0]
 | 
				
			||||||
 | 
					  jquery/no-filter: [0]
 | 
				
			||||||
 | 
					  jquery/no-find: [0]
 | 
				
			||||||
 | 
					  jquery/no-global-eval: [2]
 | 
				
			||||||
 | 
					  jquery/no-grep: [2]
 | 
				
			||||||
 | 
					  jquery/no-has: [2]
 | 
				
			||||||
 | 
					  jquery/no-hide: [0]
 | 
				
			||||||
 | 
					  jquery/no-html: [0]
 | 
				
			||||||
 | 
					  jquery/no-in-array: [2]
 | 
				
			||||||
 | 
					  jquery/no-is-array: [2]
 | 
				
			||||||
 | 
					  jquery/no-is-function: [2]
 | 
				
			||||||
 | 
					  jquery/no-is: [0]
 | 
				
			||||||
 | 
					  jquery/no-load: [2]
 | 
				
			||||||
 | 
					  jquery/no-map: [0]
 | 
				
			||||||
 | 
					  jquery/no-merge: [2]
 | 
				
			||||||
 | 
					  jquery/no-param: [2]
 | 
				
			||||||
 | 
					  jquery/no-parent: [0]
 | 
				
			||||||
 | 
					  jquery/no-parents: [0]
 | 
				
			||||||
 | 
					  jquery/no-parse-html: [2]
 | 
				
			||||||
 | 
					  jquery/no-prop: [0]
 | 
				
			||||||
 | 
					  jquery/no-proxy: [2]
 | 
				
			||||||
 | 
					  jquery/no-ready: [0]
 | 
				
			||||||
 | 
					  jquery/no-serialize: [2]
 | 
				
			||||||
 | 
					  jquery/no-show: [0]
 | 
				
			||||||
 | 
					  jquery/no-size: [2]
 | 
				
			||||||
 | 
					  jquery/no-sizzle: [0]
 | 
				
			||||||
 | 
					  jquery/no-slide: [0]
 | 
				
			||||||
 | 
					  jquery/no-submit: [0]
 | 
				
			||||||
 | 
					  jquery/no-text: [0]
 | 
				
			||||||
 | 
					  jquery/no-toggle: [0]
 | 
				
			||||||
 | 
					  jquery/no-trigger: [0]
 | 
				
			||||||
 | 
					  jquery/no-trim: [2]
 | 
				
			||||||
 | 
					  jquery/no-val: [0]
 | 
				
			||||||
 | 
					  jquery/no-when: [2]
 | 
				
			||||||
 | 
					  jquery/no-wrap: [2]
 | 
				
			||||||
  key-spacing: [2]
 | 
					  key-spacing: [2]
 | 
				
			||||||
  keyword-spacing: [2]
 | 
					  keyword-spacing: [2]
 | 
				
			||||||
  line-comment-position: [0]
 | 
					  line-comment-position: [0]
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										17
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										17
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							@@ -48,6 +48,7 @@
 | 
				
			|||||||
        "eslint": "8.15.0",
 | 
					        "eslint": "8.15.0",
 | 
				
			||||||
        "eslint-plugin-html": "6.2.0",
 | 
					        "eslint-plugin-html": "6.2.0",
 | 
				
			||||||
        "eslint-plugin-import": "2.26.0",
 | 
					        "eslint-plugin-import": "2.26.0",
 | 
				
			||||||
 | 
					        "eslint-plugin-jquery": "1.5.1",
 | 
				
			||||||
        "eslint-plugin-unicorn": "42.0.0",
 | 
					        "eslint-plugin-unicorn": "42.0.0",
 | 
				
			||||||
        "eslint-plugin-vue": "8.7.1",
 | 
					        "eslint-plugin-vue": "8.7.1",
 | 
				
			||||||
        "jest": "28.1.0",
 | 
					        "jest": "28.1.0",
 | 
				
			||||||
@@ -4352,6 +4353,15 @@
 | 
				
			|||||||
      "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
 | 
					      "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
 | 
				
			||||||
      "dev": true
 | 
					      "dev": true
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					    "node_modules/eslint-plugin-jquery": {
 | 
				
			||||||
 | 
					      "version": "1.5.1",
 | 
				
			||||||
 | 
					      "resolved": "https://registry.npmjs.org/eslint-plugin-jquery/-/eslint-plugin-jquery-1.5.1.tgz",
 | 
				
			||||||
 | 
					      "integrity": "sha512-L7v1eaK5t80C0lvUXPFP9MKnBOqPSKhCOYyzy4LZ0+iK+TJwN8S9gAkzzP1AOhypRIwA88HF6phQ9C7jnOpW8w==",
 | 
				
			||||||
 | 
					      "dev": true,
 | 
				
			||||||
 | 
					      "peerDependencies": {
 | 
				
			||||||
 | 
					        "eslint": ">=5.4.0"
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
    "node_modules/eslint-plugin-unicorn": {
 | 
					    "node_modules/eslint-plugin-unicorn": {
 | 
				
			||||||
      "version": "42.0.0",
 | 
					      "version": "42.0.0",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/eslint-plugin-unicorn/-/eslint-plugin-unicorn-42.0.0.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/eslint-plugin-unicorn/-/eslint-plugin-unicorn-42.0.0.tgz",
 | 
				
			||||||
@@ -13443,6 +13453,13 @@
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					    "eslint-plugin-jquery": {
 | 
				
			||||||
 | 
					      "version": "1.5.1",
 | 
				
			||||||
 | 
					      "resolved": "https://registry.npmjs.org/eslint-plugin-jquery/-/eslint-plugin-jquery-1.5.1.tgz",
 | 
				
			||||||
 | 
					      "integrity": "sha512-L7v1eaK5t80C0lvUXPFP9MKnBOqPSKhCOYyzy4LZ0+iK+TJwN8S9gAkzzP1AOhypRIwA88HF6phQ9C7jnOpW8w==",
 | 
				
			||||||
 | 
					      "dev": true,
 | 
				
			||||||
 | 
					      "requires": {}
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
    "eslint-plugin-unicorn": {
 | 
					    "eslint-plugin-unicorn": {
 | 
				
			||||||
      "version": "42.0.0",
 | 
					      "version": "42.0.0",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/eslint-plugin-unicorn/-/eslint-plugin-unicorn-42.0.0.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/eslint-plugin-unicorn/-/eslint-plugin-unicorn-42.0.0.tgz",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -48,6 +48,7 @@
 | 
				
			|||||||
    "eslint": "8.15.0",
 | 
					    "eslint": "8.15.0",
 | 
				
			||||||
    "eslint-plugin-html": "6.2.0",
 | 
					    "eslint-plugin-html": "6.2.0",
 | 
				
			||||||
    "eslint-plugin-import": "2.26.0",
 | 
					    "eslint-plugin-import": "2.26.0",
 | 
				
			||||||
 | 
					    "eslint-plugin-jquery": "1.5.1",
 | 
				
			||||||
    "eslint-plugin-unicorn": "42.0.0",
 | 
					    "eslint-plugin-unicorn": "42.0.0",
 | 
				
			||||||
    "eslint-plugin-vue": "8.7.1",
 | 
					    "eslint-plugin-vue": "8.7.1",
 | 
				
			||||||
    "jest": "28.1.0",
 | 
					    "jest": "28.1.0",
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user