@dineroregnskab/eslint-plugin-custom-rules 2.0.0 → 2.0.1

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.
@@ -1,5 +1,5 @@
1
1
  const returnReducerRule = require('./rules/reducers-should-always-return');
2
- const camelCaseRule = require('./rules/camel-case');
2
+ const camelCaseRule = require('./rules/camel-case-attributes');
3
3
 
4
4
  const customRulesplugin = {
5
5
  rules: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dineroregnskab/eslint-plugin-custom-rules",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "ESLint plugin with custom rules for Dineroregnskab",
5
5
  "main": "eslint-plugin-custom-rules.js",
6
6
  "scripts": {
@@ -1,30 +1,39 @@
1
1
  module.exports = {
2
2
  meta: {
3
- type: 'problem',
4
- docs: {
5
- description: 'Enforce camel case for data-cy and id attributes',
6
- category: 'Possible Errors',
7
- },
8
- fixable: 'code',
9
- schema: [],
3
+ type: 'problem',
4
+ docs: {
5
+ description: 'Enforce camel case for data-cy and id attributes',
6
+ },
7
+ fixable: 'code',
8
+ schema: [],
10
9
  },
11
10
 
12
11
  create(context) {
13
- return {
14
- 'VAttribute[directive=false][key.name="data-cy"], VAttribute[directive=false][key.name="id"]': function (node) {
15
- const value = node.value && node.value.value;
16
- const camelCasedValue = value.replace(/-([a-z])/g, function (g) { return g[1].toUpperCase(); });
12
+ return {
13
+ 'VAttribute[directive=false][key.name="data-cy"], VAttribute[directive=false][key.name="id"]':
14
+ function (node) {
15
+ const value = node.value && node.value.value;
16
+ const camelCasedValue = value.replace(
17
+ /-([a-z])/g,
18
+ function (g) {
19
+ return g[1].toUpperCase();
20
+ },
21
+ );
17
22
 
18
- if (value !== camelCasedValue) {
19
- context.report({
20
- node,
21
- message: 'The value of data-cy and id attributes must be in camelCase.',
22
- fix(fixer) {
23
- return fixer.replaceText(node.value, `"${camelCasedValue}"`);
24
- }
25
- });
26
- }
27
- }
28
- };
23
+ if (value !== camelCasedValue) {
24
+ context.report({
25
+ node,
26
+ message:
27
+ 'The value of data-cy and id attributes must be in camelCase.',
28
+ fix(fixer) {
29
+ return fixer.replaceText(
30
+ node.value,
31
+ `"${camelCasedValue}"`,
32
+ );
33
+ },
34
+ });
35
+ }
36
+ },
37
+ };
29
38
  },
30
- };
39
+ };