eslint-plugin-crisp 1.1.8 → 1.1.9
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/README.md +0 -6
- package/package.json +1 -1
- package/rules/header-check.js +14 -1
package/README.md
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
# ESLint Plugin Crisp
|
|
3
2
|
|
|
4
3
|
[](https://github.com/crisp-oss/eslint-plugin-crisp/actions?query=workflow%3A%22Build+and+Release%22) [](https://www.npmjs.com/package/eslint-plugin-crisp) [](https://www.npmjs.com/package/eslint-plugin-crisp)
|
|
@@ -12,11 +11,6 @@ A set of custom [ESLint](https://eslint.org/) configurations and rules for Crisp
|
|
|
12
11
|
The plugin provides two configurations:
|
|
13
12
|
* `recommended`: JS rules targetting backend code (Node.js)
|
|
14
13
|
* `recommended-vue`: JS rules targetting frontend code (Vue.js)
|
|
15
|
-
import crisp from "eslint-plugin-crisp";
|
|
16
|
-
|
|
17
|
-
/**************************************************************************
|
|
18
|
-
* CONFIGURATION
|
|
19
|
-
***************************************************************************/
|
|
20
14
|
|
|
21
15
|
Add the plugin in your ESLint config object, then extend the desired configuration:
|
|
22
16
|
```javascript
|
package/package.json
CHANGED
package/rules/header-check.js
CHANGED
|
@@ -9,12 +9,25 @@ export default {
|
|
|
9
9
|
category: "Best Practices",
|
|
10
10
|
recommended: false,
|
|
11
11
|
},
|
|
12
|
+
schema: [
|
|
13
|
+
{
|
|
14
|
+
type: "object",
|
|
15
|
+
properties: {
|
|
16
|
+
patterns: {
|
|
17
|
+
type: "array",
|
|
18
|
+
items: { type: "string" },
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
additionalProperties: false,
|
|
22
|
+
},
|
|
23
|
+
],
|
|
12
24
|
fixable: null, // This rule is not auto-fixable
|
|
13
25
|
},
|
|
14
26
|
|
|
15
27
|
create(context) {
|
|
16
28
|
return {
|
|
17
29
|
Program(node) {
|
|
30
|
+
const options = context.options[0] || {};
|
|
18
31
|
const fileName = context.getFilename();
|
|
19
32
|
|
|
20
33
|
let fileContent = fs.readFileSync(path.resolve(fileName), "utf8");
|
|
@@ -25,7 +38,7 @@ export default {
|
|
|
25
38
|
const fileExtension = path.extname(fileName);
|
|
26
39
|
|
|
27
40
|
// Base header comment patterns
|
|
28
|
-
let basePatterns = [
|
|
41
|
+
let basePatterns = options.patterns || [
|
|
29
42
|
"\n \\* This file is part of .+\\n \\*\\n \\* Copyright \\(c\\) \\d{4} Crisp IM SAS\\n \\* All rights belong to Crisp IM SAS\\n ",
|
|
30
43
|
"\n \\* This file is part of .+\\n \\* .+ script\\n \\*\\n \\* Copyright \\d{4}, Crisp IM SAS\\n \\* Author: .+\\n ",
|
|
31
44
|
"\n \\* Bundle: .+\\n \\* Project: .+\\n \\* Author: .+\\n \\* Copyright: \\d{4}, Crisp IM SAS\\n "
|