tslint-rules-bunch

Collection of the `tslint` rules

The module has been deprecated because the upstream "tslint" project itself got deprecated
Last updated 3 years ago by vladimiry .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install tslint-rules-bunch 
SYNC missed versions from official npm registry.

tslint-rules-bunch

is a module that contains a set of the tslint rules.

Build Status: Linux / MacOS

Rules

no-import-zones

Forbids specific imports for the specified targets using micromatch patterns matching.

Imagine you have the following directory structure:

└── project
    ├── dist
    ├── src
    │   ├── lib
    │   └── test
    └── tslint.json

You keep the built/compiled/transpiled/release code in the dist directory, source code in src/lib and tests code in src/test. For example you want to make sure that code under src/test directory doesn't import anything from the src/lib as you want tests code does import only from the dist (release code). But as an exclusion you want to allow tests code import stuff from the src/lib/module-1. You can enforce such scenario putting the no-import-zones rule into your tslint.json:

{
  "rulesDirectory": [
    "node_modules/tslint-rules-bunch/rules"
  ],
  "rules": {
    "no-import-zones": [
      true,
      {
        "zones": [
          {
            "patterns": [
              {
                "target": "src/test/**/*",
                "from": [
                  "src/lib",
                  "src/lib/**/*",
                  "!src/lib/module-1"
                ]
              }
            ]
          }
        ]
      }
    ]
  }
}

With the basePath value set to src, no-import-zones block would look like this (pattern values don't start from the src anymore):

    "no-import-zones": [
      true,
      {
        "basePath": "src",
        "verbose": true,
        "zones": [
          {
            "patterns": [
              {
                "target": "test/**/*",
                "from": [
                  "lib",
                  "lib/**/*",
                  "!lib/module-1"
                ]
              }
            ]
          }
        ]
      }
    ]

Above code related notes:

  • basePath: defines the base path value that is used for resolving <pattern object>.target and <pattern object>.from values relative to the process.cwd(). It can be set on the top level and also on the specific zone level. The property is optional, by default process.cwd() is used as the base path value.
  • verbose: flag value that toggles detailed failure output, default value is undefined, means false;
  • <pattern object>.target: can be a single value or array of the path pattern to which the forbidding logic should be applied.
  • <pattern object>.from: can be a single value or array of the import patterns that are not allowed to be used by the files matched against the <pattern object>.target pattern.

Current Tags

  • 1.0.0                                ...           latest (4 months ago)

13 Versions

  • 1.0.0 [deprecated]           ...           4 months ago
  • 0.0.10 [deprecated]           ...           4 months ago
  • 0.0.8 [deprecated]           ...           a year ago
  • 0.0.7 [deprecated]           ...           2 years ago
  • 0.0.6 [deprecated]           ...           2 years ago
  • 0.0.5 [deprecated]           ...           2 years ago
  • 0.0.4 [deprecated]           ...           2 years ago
  • 0.0.3 [deprecated]           ...           3 years ago
  • 0.0.2 [deprecated]           ...           3 years ago
  • 0.0.1 [deprecated]           ...           3 years ago
  • 0.0.1-alpha.3                                ...           3 years ago
  • 0.0.1-alpha.2                                ...           3 years ago
  • 0.0.1-alpha.1                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (1)
Dev Dependencies (16)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |