@bigbinary/eslint-plugin-neeto 1.0.20 → 1.0.21

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.
Files changed (2) hide show
  1. package/dist/index.js +22 -8
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3923,14 +3923,15 @@
3923
3923
  meta: {
3924
3924
  type: "problem",
3925
3925
  docs: {
3926
- description: `Axios should only be imported and used inside scripts within "${APIS_DIRECTORY}"`
3926
+ description: `Axios should only be imported and used inside scripts within the "apis" directory`
3927
3927
  }
3928
3928
  },
3929
3929
  create: context => ({
3930
3930
  ImportDeclaration(node) {
3931
- // Do not replace this with `isInsideApisDirectory` since this rule should include axios.js
3931
+ const aliases = context.options[0]; // Do not replace this with `isInsideApisDirectory` since this rule should include axios.js
3932
3932
  // `isInsideApisDirectory` returns false for apis/axios.js
3933
- const apisFolder = path__default["default"].resolve(APIS_DIRECTORY);
3933
+
3934
+ const apisFolder = path__default["default"].resolve((aliases === null || aliases === void 0 ? void 0 : aliases.apis) || APIS_DIRECTORY);
3934
3935
  if (context.getFilename().startsWith(apisFolder)) return;
3935
3936
  if (!isPackageImported(context, node, "axios")) return;
3936
3937
  context.report(node, NO_AXIOS_IMPORT_OUTSIDE_APIS_MESSAGE);
@@ -4039,6 +4040,10 @@
4039
4040
  type: TYPES.LITERAL
4040
4041
  }]
4041
4042
  }];
4043
+ const PLURAL_TYPES = {
4044
+ SINGULAR: "SINGULAR",
4045
+ PLURAL: "PLURAL"
4046
+ };
4042
4047
 
4043
4048
  const i18next = ramda.memoizeWith(() => "", () => require("i18next"));
4044
4049
 
@@ -4127,7 +4132,7 @@
4127
4132
  },
4128
4133
  create: context => ({
4129
4134
  CallExpression(node) {
4130
- var _node$arguments$;
4135
+ var _node$arguments$, _node$arguments$2;
4131
4136
 
4132
4137
  if (!matchesAny(LOCALIZATION_CALL_PATTERNS, node)) return;
4133
4138
  const config = {};
@@ -4135,6 +4140,12 @@
4135
4140
  if (((_node$arguments$ = node.arguments[1]) === null || _node$arguments$ === void 0 ? void 0 : _node$arguments$.type) === TYPES.OBJECT_EXPRESSION) {
4136
4141
  config.count = getObjectPropValue(node.arguments[1], "count");
4137
4142
  config.context = getObjectPropValue(node.arguments[1], "context");
4143
+ } else if (((_node$arguments$2 = node.arguments[1]) === null || _node$arguments$2 === void 0 ? void 0 : _node$arguments$2.type) === TYPES.IDENTIFIER) {
4144
+ if (node.arguments[1].name === PLURAL_TYPES.SINGULAR) {
4145
+ config.count = 1;
4146
+ } else if (node.arguments[1].name === PLURAL_TYPES.PLURAL) {
4147
+ config.count = 2;
4148
+ }
4138
4149
  }
4139
4150
 
4140
4151
  checkAndReport$1({
@@ -5561,10 +5572,13 @@
5561
5572
  const removeComments = json => JSON.parse(json.replace(/\\"|"(?:\\"|[^"])*"|(\/\/.*|\/\*[\s\S]*?\*\/)/g, (m, g) => g ? "" : m));
5562
5573
 
5563
5574
  const parseJsconfigData = ramda.memoizeWith(ramda.identity, jsconfigFilePath => {
5564
- if (!jsconfigFilePath) return null;
5565
- const jsonData = fs__default["default"].readFileSync(jsconfigFilePath).toString();
5566
- const parsedJsonData = removeComments(jsonData);
5567
- return parsedJsonData;
5575
+ try {
5576
+ const jsonData = fs__default["default"].readFileSync(jsconfigFilePath).toString();
5577
+ const parsedJsonData = removeComments(jsonData);
5578
+ return parsedJsonData;
5579
+ } catch {
5580
+ return {};
5581
+ }
5568
5582
  });
5569
5583
  var webpackAliasesAndJsconfigPathsShouldBeInSync = {
5570
5584
  meta: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigbinary/eslint-plugin-neeto",
3
- "version": "1.0.20",
3
+ "version": "1.0.21",
4
4
  "main": "dist/index.js",
5
5
  "license": "UNLICENSED",
6
6
  "scripts": {