minor adjustment to readme
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / eslint / lib / rules / no-multi-str.js
1 /**
2  * @fileoverview Rule to flag when using multiline strings
3  * @author Ilya Volodin
4  */
5
6 "use strict";
7
8 //------------------------------------------------------------------------------
9 // Requirements
10 //------------------------------------------------------------------------------
11
12 const astUtils = require("./utils/ast-utils");
13
14 //------------------------------------------------------------------------------
15 // Rule Definition
16 //------------------------------------------------------------------------------
17
18 module.exports = {
19     meta: {
20         type: "suggestion",
21
22         docs: {
23             description: "disallow multiline strings",
24             category: "Best Practices",
25             recommended: false,
26             url: "https://eslint.org/docs/rules/no-multi-str"
27         },
28
29         schema: []
30     },
31
32     create(context) {
33
34         /**
35          * Determines if a given node is part of JSX syntax.
36          * @param {ASTNode} node The node to check.
37          * @returns {boolean} True if the node is a JSX node, false if not.
38          * @private
39          */
40         function isJSXElement(node) {
41             return node.type.indexOf("JSX") === 0;
42         }
43
44         //--------------------------------------------------------------------------
45         // Public API
46         //--------------------------------------------------------------------------
47
48         return {
49
50             Literal(node) {
51                 if (astUtils.LINEBREAK_MATCHER.test(node.raw) && !isJSXElement(node.parent)) {
52                     context.report({ node, message: "Multiline support is limited to browsers supporting ES5 only." });
53                 }
54             }
55         };
56
57     }
58 };