@so1ve/eslint-plugin 0.57.0 → 0.59.0

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/dist/index.cjs CHANGED
@@ -4,9 +4,9 @@ const utils = require('@typescript-eslint/utils');
4
4
 
5
5
  const createEslintRule = utils.ESLintUtils.RuleCreator((ruleName) => ruleName);
6
6
 
7
- const RULE_NAME$1 = "import-dedupe";
7
+ const RULE_NAME$2 = "import-dedupe";
8
8
  const importDedupe = createEslintRule({
9
- name: RULE_NAME$1,
9
+ name: RULE_NAME$2,
10
10
  meta: {
11
11
  type: "problem",
12
12
  docs: {
@@ -54,9 +54,9 @@ const importDedupe = createEslintRule({
54
54
  }
55
55
  });
56
56
 
57
- const RULE_NAME = "no-inline-type-import";
57
+ const RULE_NAME$1 = "no-inline-type-import";
58
58
  const noInlineTypeImport = createEslintRule({
59
- name: RULE_NAME,
59
+ name: RULE_NAME$1,
60
60
  meta: {
61
61
  type: "layout",
62
62
  docs: {
@@ -106,10 +106,47 @@ import { ${valueSpecifiersText} } from "${node.source.value}";`
106
106
  }
107
107
  });
108
108
 
109
+ const RULE_NAME = "no-useless-template-string";
110
+ const noUselessTemplateString = createEslintRule({
111
+ name: RULE_NAME,
112
+ meta: {
113
+ type: "problem",
114
+ docs: {
115
+ description: "No useless template string",
116
+ recommended: "error"
117
+ },
118
+ fixable: "code",
119
+ schema: [],
120
+ messages: {
121
+ noUselessTemplateString: "No useless template string"
122
+ }
123
+ },
124
+ defaultOptions: [],
125
+ create: (context) => {
126
+ return {
127
+ TemplateLiteral(node) {
128
+ const hasNewline = node.quasis.some((n) => n.value.raw.includes("\n"));
129
+ if (node.expressions.length === 0 && !hasNewline) {
130
+ context.report({
131
+ node,
132
+ messageId: "noUselessTemplateString",
133
+ fix(fixer) {
134
+ const s = node.range[0];
135
+ const e = node.range[1];
136
+ return fixer.replaceTextRange([s, e], `"${node.quasis[0].value.raw}"`);
137
+ }
138
+ });
139
+ }
140
+ }
141
+ };
142
+ }
143
+ });
144
+
109
145
  const index = {
110
146
  rules: {
111
147
  "import-dedupe": importDedupe,
112
- "no-inline-type-import": noInlineTypeImport
148
+ "no-inline-type-import": noInlineTypeImport,
149
+ "no-useless-template-string": noUselessTemplateString
113
150
  }
114
151
  };
115
152
 
package/dist/index.d.ts CHANGED
@@ -4,6 +4,7 @@ declare const _default: {
4
4
  rules: {
5
5
  "import-dedupe": _typescript_eslint_utils_dist_ts_eslint_Rule.RuleModule<"importDedupe", [], _typescript_eslint_utils_dist_ts_eslint_Rule.RuleListener>;
6
6
  "no-inline-type-import": _typescript_eslint_utils_dist_ts_eslint_Rule.RuleModule<"noInlineTypeImport", [], _typescript_eslint_utils_dist_ts_eslint_Rule.RuleListener>;
7
+ "no-useless-template-string": _typescript_eslint_utils_dist_ts_eslint_Rule.RuleModule<"noUselessTemplateString", [], _typescript_eslint_utils_dist_ts_eslint_Rule.RuleListener>;
7
8
  };
8
9
  };
9
10
 
package/dist/index.mjs CHANGED
@@ -2,9 +2,9 @@ import { ESLintUtils } from '@typescript-eslint/utils';
2
2
 
3
3
  const createEslintRule = ESLintUtils.RuleCreator((ruleName) => ruleName);
4
4
 
5
- const RULE_NAME$1 = "import-dedupe";
5
+ const RULE_NAME$2 = "import-dedupe";
6
6
  const importDedupe = createEslintRule({
7
- name: RULE_NAME$1,
7
+ name: RULE_NAME$2,
8
8
  meta: {
9
9
  type: "problem",
10
10
  docs: {
@@ -52,9 +52,9 @@ const importDedupe = createEslintRule({
52
52
  }
53
53
  });
54
54
 
55
- const RULE_NAME = "no-inline-type-import";
55
+ const RULE_NAME$1 = "no-inline-type-import";
56
56
  const noInlineTypeImport = createEslintRule({
57
- name: RULE_NAME,
57
+ name: RULE_NAME$1,
58
58
  meta: {
59
59
  type: "layout",
60
60
  docs: {
@@ -104,10 +104,47 @@ import { ${valueSpecifiersText} } from "${node.source.value}";`
104
104
  }
105
105
  });
106
106
 
107
+ const RULE_NAME = "no-useless-template-string";
108
+ const noUselessTemplateString = createEslintRule({
109
+ name: RULE_NAME,
110
+ meta: {
111
+ type: "problem",
112
+ docs: {
113
+ description: "No useless template string",
114
+ recommended: "error"
115
+ },
116
+ fixable: "code",
117
+ schema: [],
118
+ messages: {
119
+ noUselessTemplateString: "No useless template string"
120
+ }
121
+ },
122
+ defaultOptions: [],
123
+ create: (context) => {
124
+ return {
125
+ TemplateLiteral(node) {
126
+ const hasNewline = node.quasis.some((n) => n.value.raw.includes("\n"));
127
+ if (node.expressions.length === 0 && !hasNewline) {
128
+ context.report({
129
+ node,
130
+ messageId: "noUselessTemplateString",
131
+ fix(fixer) {
132
+ const s = node.range[0];
133
+ const e = node.range[1];
134
+ return fixer.replaceTextRange([s, e], `"${node.quasis[0].value.raw}"`);
135
+ }
136
+ });
137
+ }
138
+ }
139
+ };
140
+ }
141
+ });
142
+
107
143
  const index = {
108
144
  rules: {
109
145
  "import-dedupe": importDedupe,
110
- "no-inline-type-import": noInlineTypeImport
146
+ "no-inline-type-import": noInlineTypeImport,
147
+ "no-useless-template-string": noUselessTemplateString
111
148
  }
112
149
  };
113
150
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@so1ve/eslint-plugin",
3
- "version": "0.57.0",
3
+ "version": "0.59.0",
4
4
  "author": "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
5
5
  "contributors": [
6
6
  {