@alextheman/eslint-plugin 3.1.2 → 3.1.3

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
@@ -3765,7 +3765,7 @@ module.exports = __toCommonJS(index_exports);
3765
3765
 
3766
3766
  // package.json
3767
3767
  var name = "@alextheman/eslint-plugin";
3768
- var version = "3.1.2";
3768
+ var version = "3.1.3";
3769
3769
 
3770
3770
  // src/configs/index.ts
3771
3771
  var import_eslint_plugin_package_json = __toESM(require("eslint-plugin-package-json"), 1);
@@ -3993,6 +3993,14 @@ function createPersonalJavaScriptBaseConfig(plugin) {
3993
3993
  "prettier/prettier": ["warn", prettierRules_default],
3994
3994
  "sort-vars": "error"
3995
3995
  }
3996
+ },
3997
+ {
3998
+ files: ["src/**/index.{js,jsx,ts,tsx}"],
3999
+ rules: {
4000
+ // Since index files generally tend to export files from the same folder, they tend to be more coupled with their location in the folder,
4001
+ // so it feels more natural to allow only root-level relative imports from an index file.
4002
+ "@alextheman/no-relative-imports": ["error", { depth: 0 }]
4003
+ }
3996
4004
  }
3997
4005
  ];
3998
4006
  }
@@ -4991,7 +4999,7 @@ var useNormalizedImports = createRule_default({
4991
4999
  );
4992
5000
  return {
4993
5001
  ImportDeclaration(node) {
4994
- const normalizedPath = import_path.default.posix.normalize(node.source.value);
5002
+ const normalizedPath = node.source.value.startsWith("./") ? `./${import_path.default.posix.normalize(node.source.value)}` : import_path.default.posix.normalize(node.source.value);
4995
5003
  if (node.source.value !== normalizedPath) {
4996
5004
  return context.report({
4997
5005
  node,
package/dist/index.d.cts CHANGED
@@ -4,7 +4,7 @@ import { Config } from 'prettier';
4
4
  import z from 'zod';
5
5
 
6
6
  var name = "@alextheman/eslint-plugin";
7
- var version = "3.1.2";
7
+ var version = "3.1.3";
8
8
 
9
9
  type CamelToKebab<S extends string> = S extends `${IgnoreCase<"J">}avaScript${infer Rest}` ? Rest extends "" ? "javascript" : `javascript${CamelToKebab<Rest>}` : S extends `${IgnoreCase<"T">}ypeScript${infer Rest}` ? Rest extends "" ? "typescript" : `typescript${CamelToKebab<Rest>}` : S extends `${infer Head}${infer Tail}` ? Head extends Lowercase<Head> ? `${Head}${CamelToKebab<Tail>}` : `-${Lowercase<Head>}${CamelToKebab<Tail>}` : S;
10
10
 
package/dist/index.d.ts CHANGED
@@ -4,7 +4,7 @@ import { Config } from 'prettier';
4
4
  import z from 'zod';
5
5
 
6
6
  var name = "@alextheman/eslint-plugin";
7
- var version = "3.1.2";
7
+ var version = "3.1.3";
8
8
 
9
9
  type CamelToKebab<S extends string> = S extends `${IgnoreCase<"J">}avaScript${infer Rest}` ? Rest extends "" ? "javascript" : `javascript${CamelToKebab<Rest>}` : S extends `${IgnoreCase<"T">}ypeScript${infer Rest}` ? Rest extends "" ? "typescript" : `typescript${CamelToKebab<Rest>}` : S extends `${infer Head}${infer Tail}` ? Head extends Lowercase<Head> ? `${Head}${CamelToKebab<Tail>}` : `-${Lowercase<Head>}${CamelToKebab<Tail>}` : S;
10
10
 
package/dist/index.js CHANGED
@@ -3744,7 +3744,7 @@ var require_src = __commonJS({
3744
3744
 
3745
3745
  // package.json
3746
3746
  var name = "@alextheman/eslint-plugin";
3747
- var version = "3.1.2";
3747
+ var version = "3.1.3";
3748
3748
 
3749
3749
  // src/configs/index.ts
3750
3750
  import packageJson from "eslint-plugin-package-json";
@@ -3972,6 +3972,14 @@ function createPersonalJavaScriptBaseConfig(plugin) {
3972
3972
  "prettier/prettier": ["warn", prettierRules_default],
3973
3973
  "sort-vars": "error"
3974
3974
  }
3975
+ },
3976
+ {
3977
+ files: ["src/**/index.{js,jsx,ts,tsx}"],
3978
+ rules: {
3979
+ // Since index files generally tend to export files from the same folder, they tend to be more coupled with their location in the folder,
3980
+ // so it feels more natural to allow only root-level relative imports from an index file.
3981
+ "@alextheman/no-relative-imports": ["error", { depth: 0 }]
3982
+ }
3975
3983
  }
3976
3984
  ];
3977
3985
  }
@@ -4970,7 +4978,7 @@ var useNormalizedImports = createRule_default({
4970
4978
  );
4971
4979
  return {
4972
4980
  ImportDeclaration(node) {
4973
- const normalizedPath = path.posix.normalize(node.source.value);
4981
+ const normalizedPath = node.source.value.startsWith("./") ? `./${path.posix.normalize(node.source.value)}` : path.posix.normalize(node.source.value);
4974
4982
  if (node.source.value !== normalizedPath) {
4975
4983
  return context.report({
4976
4984
  node,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alextheman/eslint-plugin",
3
- "version": "3.1.2",
3
+ "version": "3.1.3",
4
4
  "description": "A package to provide custom ESLint rules and configs",
5
5
  "repository": {
6
6
  "type": "git",