eslint-plugin-mgw-eslint-rules 1.0.0 → 1.0.2

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/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  module.exports = {
2
2
  rules: {
3
3
  'prefer-const-enum': require('./prefer-const-enum'),
4
+ 'no-inferrable-types-readonly-properties': require('./no-inferrable-types-readonly-properties')
4
5
  },
5
6
  };
@@ -0,0 +1,19 @@
1
+ // mgw-eslint-rules/no-inferrable-types-readonly-properties.js
2
+ module.exports = {
3
+ create(context) {
4
+ return {
5
+ PropertyDefinition(node) {
6
+ if (
7
+ node.readonly &&
8
+ node.typeAnnotation &&
9
+ node.typeAnnotation.typeAnnotation
10
+ ) {
11
+ context.report({
12
+ node: node.typeAnnotation,
13
+ message: `Type ${node.typeAnnotation.typeAnnotation} on a readonly propertie trivially inferred from a ${node.typeAnnotation.typeAnnotation} literal, remove type annotation.`,
14
+ });
15
+ }
16
+ },
17
+ };
18
+ },
19
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-mgw-eslint-rules",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Custom eslint rules of MegaO",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,3 +1,4 @@
1
+ // mgw-eslint-rules/prefer-const-enum.js
1
2
  module.exports = {
2
3
  create(context) {
3
4
  return {