create project

This commit is contained in:
ismailsosic
2022-12-27 12:05:56 +01:00
parent 2a33a2d3de
commit cd2143287c
16035 changed files with 2489703 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
"use strict";
var _defineRule = require("../utils/define-rule");
var url = "https://nextjs.org/docs/messages/no-sync-scripts";
module.exports = (0, _defineRule).defineRule({
meta: {
docs: {
description: "Prevent synchronous scripts.",
recommended: true,
url: url
},
type: "problem",
schema: []
},
create: function create(context) {
return {
JSXOpeningElement: function JSXOpeningElement(node) {
if (node.name.name !== "script") {
return;
}
if (node.attributes.length === 0) {
return;
}
var attributeNames = node.attributes.filter(function(attr) {
return attr.type === "JSXAttribute";
}).map(function(attr) {
return attr.name.name;
});
if (attributeNames.includes("src") && !attributeNames.includes("async") && !attributeNames.includes("defer")) {
context.report({
node: node,
message: "Synchronous scripts should not be used. See: ".concat(url)
});
}
}
};
}
});