UNPKG

635 BJavaScriptView Raw
1'use strict'
2
3const utils = require('./utils.js')
4
5module.exports = {
6 meta: {
7 docs: {},
8 schema: []
9 },
10
11 create: function(context) {
12 const forbidden = ['serialize', 'serializeArray']
13
14 return {
15 CallExpression: function(node) {
16 if (node.callee.type !== 'MemberExpression') return
17 if (forbidden.indexOf(node.callee.property.name) === -1) return
18
19 if (utils.isjQuery(node)) {
20 context.report({
21 node: node,
22 message:
23 'Prefer FormData or URLSearchParams to $.' +
24 node.callee.property.name
25 })
26 }
27 }
28 }
29 }
30}