1.1.1 • Published 2 months ago

eslint-plugin-jimdo-custom-rules v1.1.1

Weekly downloads
-
License
-
Repository
github
Last release
2 months ago

jimdo-custom-rules

Restricted Import Paths - disallow-imports-in-folder

Some projects have files that aren't meant to be executed in the same environment. For instance, think about a web application with distinct code for the server and the client. In such cases, importing server-only files in client code can lead to issues.

This ESLint rule allows you to specify paths that should be restricted from imports in certain areas of your project. By defining these restricted zones, you can ensure that files intended for a specific environment (e.g., server or client) are not inadvertently imported into the wrong context.

Parameters for the rule

0 - error level, error | warning 1 - rules for a folder

Installation

Install the ESLint plugin by running:

npm install --save-dev eslint-plugin-jimdo-custom-rules

Configuration

Add the plugin to your ESLint configuration file, for example, .eslintrc.js. e.g. disallow imports containing @apps/wizard in folder workspace/apps/cms

module.exports = {
  plugins: ['jimdo-custom-rules'],
  rules: {
    'jimdo-custom-rules/disallow-imports-in-folder': ['error', {
      folderRules: [
        // Define your restricted folders here
        folder: 'workspace/apps/cms',
        disallowedImports: [
            '@apps/wizard',
            ...
        ],
      ],
    }],
  },
};