2020-03-07 11:45:40 +08:00
|
|
|
/**
|
|
|
|
* @fileoverview Rule to flag use of with statement
|
|
|
|
* @author Nicholas C. Zakas
|
|
|
|
*/
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
// Rule Definition
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
meta: {
|
|
|
|
type: "suggestion",
|
|
|
|
|
|
|
|
docs: {
|
|
|
|
description: "disallow `with` statements",
|
|
|
|
category: "Best Practices",
|
2020-03-31 20:40:00 +08:00
|
|
|
recommended: true,
|
2020-03-07 11:45:40 +08:00
|
|
|
url: "https://eslint.org/docs/rules/no-with"
|
|
|
|
},
|
|
|
|
|
|
|
|
schema: []
|
|
|
|
},
|
|
|
|
|
|
|
|
create(context) {
|
|
|
|
|
|
|
|
return {
|
|
|
|
WithStatement(node) {
|
|
|
|
context.report({ node, message: "Unexpected use of 'with' statement." });
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|