@alextheman/eslint-plugin 1.13.2 → 1.13.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/dist/index.cjs +26 -12
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +26 -12
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3706,7 +3706,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
3706
3706
|
|
|
3707
3707
|
// package.json
|
|
3708
3708
|
var name = "@alextheman/eslint-plugin";
|
|
3709
|
-
var version = "1.13.
|
|
3709
|
+
var version = "1.13.4";
|
|
3710
3710
|
|
|
3711
3711
|
// src/configs/alexPluginBase.ts
|
|
3712
3712
|
function createAlexPluginBaseConfig(plugin) {
|
|
@@ -3825,6 +3825,7 @@ var typeScriptBase = [
|
|
|
3825
3825
|
"func-style": ["error", "declaration", { allowArrowFunctions: false }],
|
|
3826
3826
|
"prefer-arrow-callback": ["error", { allowNamedFunctions: false }],
|
|
3827
3827
|
"arrow-body-style": ["error", "always"],
|
|
3828
|
+
curly: ["error", "all"],
|
|
3828
3829
|
"no-param-reassign": "error",
|
|
3829
3830
|
"no-useless-rename": "error",
|
|
3830
3831
|
"sort-vars": "error",
|
|
@@ -4201,7 +4202,9 @@ var noRelativeImports = createRule_default({
|
|
|
4201
4202
|
meta: {
|
|
4202
4203
|
docs: { description: "Forbid the use of relative imports" },
|
|
4203
4204
|
messages: {
|
|
4204
|
-
|
|
4205
|
+
strictNoRelative: 'Relative import from "{{source}}" is not allowed.',
|
|
4206
|
+
rootOnly: 'Relative import from "{{source}}" is not allowed to leave the current folder.',
|
|
4207
|
+
exceededAllowedDepth: 'Relative import from "{{source}}" is not allowed. Relative imports must be no more than {{depth}} level{{s}} deep.',
|
|
4205
4208
|
stupidPath: "For the love of God, please do not mix relative path parts in your import statements like that! How can you possibly be ok with {{source}}?!"
|
|
4206
4209
|
},
|
|
4207
4210
|
type: "suggestion",
|
|
@@ -4220,22 +4223,22 @@ var noRelativeImports = createRule_default({
|
|
|
4220
4223
|
defaultOptions: [{ depth: void 0 }],
|
|
4221
4224
|
create(context) {
|
|
4222
4225
|
var _a;
|
|
4223
|
-
const
|
|
4224
|
-
if (
|
|
4225
|
-
if (
|
|
4226
|
+
const allowedDepth = (_a = context.options[0]) == null ? void 0 : _a.depth;
|
|
4227
|
+
if (allowedDepth !== void 0) {
|
|
4228
|
+
if (allowedDepth % 1 !== 0) {
|
|
4226
4229
|
throw new Error("NON_INTEGER_DEPTH_NOT_ALLOWED");
|
|
4227
4230
|
}
|
|
4228
|
-
if (
|
|
4231
|
+
if (allowedDepth < 0) {
|
|
4229
4232
|
throw new Error("NEGATIVE_DEPTH_NOT_ALLOWED");
|
|
4230
4233
|
}
|
|
4231
4234
|
}
|
|
4232
4235
|
return {
|
|
4233
4236
|
ImportDeclaration(node) {
|
|
4234
4237
|
if (node.source.value.includes("./") || node.source.value.includes("../")) {
|
|
4235
|
-
if (
|
|
4238
|
+
if (allowedDepth === void 0) {
|
|
4236
4239
|
return context.report({
|
|
4237
4240
|
node,
|
|
4238
|
-
messageId: "
|
|
4241
|
+
messageId: "strictNoRelative",
|
|
4239
4242
|
data: {
|
|
4240
4243
|
source: node.source.value
|
|
4241
4244
|
}
|
|
@@ -4260,22 +4263,33 @@ var noRelativeImports = createRule_default({
|
|
|
4260
4263
|
}
|
|
4261
4264
|
});
|
|
4262
4265
|
}
|
|
4263
|
-
if (
|
|
4266
|
+
if (allowedDepth === 0 && importPathParts[0] === ".") {
|
|
4264
4267
|
return;
|
|
4265
4268
|
}
|
|
4266
4269
|
let endOfRelativePathFound = false;
|
|
4267
|
-
for (const part of importPathParts.slice(0,
|
|
4270
|
+
for (const part of importPathParts.slice(0, allowedDepth + 1)) {
|
|
4268
4271
|
if (part !== "..") {
|
|
4269
4272
|
endOfRelativePathFound = true;
|
|
4270
4273
|
break;
|
|
4271
4274
|
}
|
|
4272
4275
|
}
|
|
4273
4276
|
if (!endOfRelativePathFound) {
|
|
4277
|
+
if (allowedDepth === 0) {
|
|
4278
|
+
return context.report({
|
|
4279
|
+
node,
|
|
4280
|
+
messageId: "rootOnly",
|
|
4281
|
+
data: {
|
|
4282
|
+
source: node.source.value
|
|
4283
|
+
}
|
|
4284
|
+
});
|
|
4285
|
+
}
|
|
4274
4286
|
return context.report({
|
|
4275
4287
|
node,
|
|
4276
|
-
messageId: "
|
|
4288
|
+
messageId: "exceededAllowedDepth",
|
|
4277
4289
|
data: {
|
|
4278
|
-
source: node.source.value
|
|
4290
|
+
source: node.source.value,
|
|
4291
|
+
depth: allowedDepth,
|
|
4292
|
+
s: allowedDepth !== 1 ? "s" : ""
|
|
4279
4293
|
}
|
|
4280
4294
|
});
|
|
4281
4295
|
}
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -3692,7 +3692,7 @@ var require_globals2 = __commonJS({
|
|
|
3692
3692
|
|
|
3693
3693
|
// package.json
|
|
3694
3694
|
var name = "@alextheman/eslint-plugin";
|
|
3695
|
-
var version = "1.13.
|
|
3695
|
+
var version = "1.13.4";
|
|
3696
3696
|
|
|
3697
3697
|
// src/configs/alexPluginBase.ts
|
|
3698
3698
|
function createAlexPluginBaseConfig(plugin) {
|
|
@@ -3811,6 +3811,7 @@ var typeScriptBase = [
|
|
|
3811
3811
|
"func-style": ["error", "declaration", { allowArrowFunctions: false }],
|
|
3812
3812
|
"prefer-arrow-callback": ["error", { allowNamedFunctions: false }],
|
|
3813
3813
|
"arrow-body-style": ["error", "always"],
|
|
3814
|
+
curly: ["error", "all"],
|
|
3814
3815
|
"no-param-reassign": "error",
|
|
3815
3816
|
"no-useless-rename": "error",
|
|
3816
3817
|
"sort-vars": "error",
|
|
@@ -4187,7 +4188,9 @@ var noRelativeImports = createRule_default({
|
|
|
4187
4188
|
meta: {
|
|
4188
4189
|
docs: { description: "Forbid the use of relative imports" },
|
|
4189
4190
|
messages: {
|
|
4190
|
-
|
|
4191
|
+
strictNoRelative: 'Relative import from "{{source}}" is not allowed.',
|
|
4192
|
+
rootOnly: 'Relative import from "{{source}}" is not allowed to leave the current folder.',
|
|
4193
|
+
exceededAllowedDepth: 'Relative import from "{{source}}" is not allowed. Relative imports must be no more than {{depth}} level{{s}} deep.',
|
|
4191
4194
|
stupidPath: "For the love of God, please do not mix relative path parts in your import statements like that! How can you possibly be ok with {{source}}?!"
|
|
4192
4195
|
},
|
|
4193
4196
|
type: "suggestion",
|
|
@@ -4206,22 +4209,22 @@ var noRelativeImports = createRule_default({
|
|
|
4206
4209
|
defaultOptions: [{ depth: void 0 }],
|
|
4207
4210
|
create(context) {
|
|
4208
4211
|
var _a;
|
|
4209
|
-
const
|
|
4210
|
-
if (
|
|
4211
|
-
if (
|
|
4212
|
+
const allowedDepth = (_a = context.options[0]) == null ? void 0 : _a.depth;
|
|
4213
|
+
if (allowedDepth !== void 0) {
|
|
4214
|
+
if (allowedDepth % 1 !== 0) {
|
|
4212
4215
|
throw new Error("NON_INTEGER_DEPTH_NOT_ALLOWED");
|
|
4213
4216
|
}
|
|
4214
|
-
if (
|
|
4217
|
+
if (allowedDepth < 0) {
|
|
4215
4218
|
throw new Error("NEGATIVE_DEPTH_NOT_ALLOWED");
|
|
4216
4219
|
}
|
|
4217
4220
|
}
|
|
4218
4221
|
return {
|
|
4219
4222
|
ImportDeclaration(node) {
|
|
4220
4223
|
if (node.source.value.includes("./") || node.source.value.includes("../")) {
|
|
4221
|
-
if (
|
|
4224
|
+
if (allowedDepth === void 0) {
|
|
4222
4225
|
return context.report({
|
|
4223
4226
|
node,
|
|
4224
|
-
messageId: "
|
|
4227
|
+
messageId: "strictNoRelative",
|
|
4225
4228
|
data: {
|
|
4226
4229
|
source: node.source.value
|
|
4227
4230
|
}
|
|
@@ -4246,22 +4249,33 @@ var noRelativeImports = createRule_default({
|
|
|
4246
4249
|
}
|
|
4247
4250
|
});
|
|
4248
4251
|
}
|
|
4249
|
-
if (
|
|
4252
|
+
if (allowedDepth === 0 && importPathParts[0] === ".") {
|
|
4250
4253
|
return;
|
|
4251
4254
|
}
|
|
4252
4255
|
let endOfRelativePathFound = false;
|
|
4253
|
-
for (const part of importPathParts.slice(0,
|
|
4256
|
+
for (const part of importPathParts.slice(0, allowedDepth + 1)) {
|
|
4254
4257
|
if (part !== "..") {
|
|
4255
4258
|
endOfRelativePathFound = true;
|
|
4256
4259
|
break;
|
|
4257
4260
|
}
|
|
4258
4261
|
}
|
|
4259
4262
|
if (!endOfRelativePathFound) {
|
|
4263
|
+
if (allowedDepth === 0) {
|
|
4264
|
+
return context.report({
|
|
4265
|
+
node,
|
|
4266
|
+
messageId: "rootOnly",
|
|
4267
|
+
data: {
|
|
4268
|
+
source: node.source.value
|
|
4269
|
+
}
|
|
4270
|
+
});
|
|
4271
|
+
}
|
|
4260
4272
|
return context.report({
|
|
4261
4273
|
node,
|
|
4262
|
-
messageId: "
|
|
4274
|
+
messageId: "exceededAllowedDepth",
|
|
4263
4275
|
data: {
|
|
4264
|
-
source: node.source.value
|
|
4276
|
+
source: node.source.value,
|
|
4277
|
+
depth: allowedDepth,
|
|
4278
|
+
s: allowedDepth !== 1 ? "s" : ""
|
|
4265
4279
|
}
|
|
4266
4280
|
});
|
|
4267
4281
|
}
|