eslint-plugin-crisp 1.0.64 → 1.0.66
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/rules/header-check.js
CHANGED
|
@@ -16,12 +16,14 @@ module.exports = {
|
|
|
16
16
|
return {
|
|
17
17
|
Program(node) {
|
|
18
18
|
const fileName = context.getFilename();
|
|
19
|
-
|
|
19
|
+
|
|
20
|
+
let fileContent = fs.readFileSync(path.resolve(fileName), "utf8");
|
|
21
|
+
|
|
22
|
+
fileContent = fileContent.trim();
|
|
20
23
|
|
|
21
24
|
// Determine the file extension
|
|
22
25
|
const fileExtension = path.extname(fileName);
|
|
23
26
|
|
|
24
|
-
// Base header comment pattern
|
|
25
27
|
// Base header comment patterns
|
|
26
28
|
let basePatterns = [
|
|
27
29
|
"\n \\* This file is part of .+\\n \\*\\n \\* Copyright \\(c\\) \\d{4} Crisp IM SAS\\n \\* All rights belong to Crisp IM SAS\\n ",
|
|
@@ -31,7 +31,7 @@ module.exports = {
|
|
|
31
31
|
// Check each tag individually
|
|
32
32
|
vueTags.forEach((tag, index) => {
|
|
33
33
|
const tagRegExp = new RegExp(`<${tag}`);
|
|
34
|
-
const headerRegExp = new RegExp(
|
|
34
|
+
const headerRegExp = new RegExp(`\\n\\n<!--\\s*\\*{70,73}\\s*\\n\\s{5}${headers[index]}\\s*\\n\\s*\\*{70,73}\\s*-->\\s*\\n\\n<${tag}`);
|
|
35
35
|
|
|
36
36
|
// If the tag exists without the corresponding header, report an error
|
|
37
37
|
if (tagRegExp.test(fileContent) && !headerRegExp.test(fileContent)) {
|