@redhat-cloud-services/eslint-config-redhat-cloud-services 2.0.2 → 2.0.4

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
@@ -24,7 +24,7 @@ module.exports = {
24
24
  'rulesdir/disallow-fec-relative-imports': 2,
25
25
  'rulesdir/deprecated-packages': 1,
26
26
  'rulesdir/no-chrome-api-call-from-window': 2,
27
- 'rulesdir/forbid-pf-relative-imports': 2,
27
+ 'rulesdir/forbid-pf-relative-imports': 1,
28
28
  'rulesdir/disallow-pf-migrated-components': 1,
29
29
  },
30
30
  globals: {
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @fileoverview Rule to suggest using the shared axios to better error handling and reporting.
3
+ * @author Muslimj0n Kholjuraev
4
+ */
5
+
6
+ module.exports = {
7
+ meta: {
8
+ type: 'suggestion',
9
+ fixable: 'code',
10
+ messages: {
11
+ useSharedAxiosMessage:
12
+ 'Avoid using axios in your project. Instead, use the shared axios instance with interceptors for better error handling and reporting',
13
+ },
14
+ docs: {
15
+ description: 'Use the shared axios instance',
16
+ url: 'https://github.com/RedHatInsights/frontend-components/blob/master/packages/utils/src/interceptors/interceptors.ts#L83',
17
+ recommended: false,
18
+ },
19
+ },
20
+ create: function (context) {
21
+ return {
22
+ ImportDeclaration: (codePath) => {
23
+ if (codePath.source.value.includes('axios')) {
24
+ context.report({
25
+ node: codePath,
26
+ messageId: 'useSharedAxiosMessage',
27
+ });
28
+ }
29
+ },
30
+ };
31
+ },
32
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redhat-cloud-services/eslint-config-redhat-cloud-services",
3
- "version": "2.0.2",
3
+ "version": "2.0.4",
4
4
  "description": "Recommended eslint configuration used in cloud.redhat.com frontend apps.",
5
5
  "keywords": [
6
6
  "eslint",