eslint-plugin-rules 6.0.0-pr254.5
Install from the command line:
Learn more about npm packages
$ npm install @shiftcode/eslint-plugin-rules@6.0.0-pr254.5
Install via package.json:
"@shiftcode/eslint-plugin-rules": "6.0.0-pr254.5"
About this version
🎯 Target runtime: es2023 (Node >= 20)
This module holds some custom eslint plugins written in typescript. See doc
for instructions on how to create custom plugins using typescript-eslint.
sample eslint.config.msj file:
import eslintScPlugin from '@shiftcode/eslint-plugin-rules'
export default defineConfig(
// ...
{
files: ['*.ts'],
extends: [eslintScPlugin.configs.recommended],
rules: {
'@shiftcode/import-denylist': [
'error',
{
patterns: [
/aws-cdk-lib\/core/,
/\.\/(core|models|shared|static)\/.*/, // use app/* instead
/^app\/core/, // disallow importing from self
/^somewhat\/.*/, // import filename must never start with "somewhat"
/example$/, // import filename must never end with "example"
// etc ...
],
},
],
},
},
// ...
)alternative you can configure the plugin like this:
import eslintScPlugin from '@shiftcode/eslint-plugin-rules'
export default defineConfig({
files: ['**/*.ts'],
plugins: {
'@shiftcode': eslintScPlugin,
},
rules: {
'@shiftcode/prefix-builtin-module-import': 'error',
// ...
},
})the following custom rules are provided within this module:
- imports from parent index files are not allowed; i.e.
import { stuff } from '..' - note: this rule is already included by @shiftcode/eslint-config-recommended
This can potentially be replaced by using no-restricted-imports
- rule accepts a config-object with a
patternsregexp array and is the pendant of the former tslint rule "import-blacklist". - example configuration: see above
This rule ensures all node builtin modules are imported with the node: prefix.
- note: this rule is already included by @shiftcode/eslint-config-recommended
✅ Correct
import { writeFile } from 'node:fs/promises'
import crypto from 'node:crypto'❌ Incorrect
import { writeFile } from 'fs/promises'
import crypto from 'crypto'Details
- eslint-plugin-rules
-
shiftcode
- 3 days ago
- MIT
- 2 dependencies
Assets
- eslint-plugin-rules-6.0.0-pr254.5.tgz
Download activity
- Total downloads 0
- Last 30 days 0
- Last week 0
- Today 0