eslint-plugin-jimdo-custom-rules

1.1.1 • Public • Published

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',
            ...
        ],
      ],
    }],
  },
};

Readme

Keywords

none

Package Sidebar

Install

npm i eslint-plugin-jimdo-custom-rules

Weekly Downloads

6

Version

1.1.1

License

none

Unpacked Size

3.17 kB

Total Files

4

Last publish

Collaborators

  • jimnpm