![Maven Central Adds Sigstore Signature Validation](https://cdn.sanity.io/images/cgdhsj6q/production/7da3bc8a946cfb5df15d7fcf49767faedc72b483-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
@bitovi/eslint-plugin-nx-glue
Advanced tools
Allows local ESLint Rules written in TypeScript to be available within Nx workspace
Allows local ESLint Rules written in TypeScript to be available within a Nx workspace or any project. This means that developers can create their own custom ESLint Plugins within a project and consume them within that project without having to publish or use Symlinks.
npm install -D @bitovi/eslint-plugin-nx-glue
This library assumes your project is an Nx workspace. If you are not, you will have to also install nx
as a dev-dependency:
npm install -D nx@15
Create an eslint-plugin-nx-glue.config.js
file at the root of your project. This file will export your ESLint Plugins by name, a path to its exported rules, and which TypeScript configuration to use:
// eslint-plugin-nx-glue.config.js
module.exports = {
'my-plugin': {
dir: 'tools/my-rules',
tsconfig: 'tools/my-rules/tsconfig.json',
},
};
This example will check tools/my-rules
for index.ts
that exports an ESLint Plugin:
// tools/my-rules/index.ts
import { myCustomRule} from './rules/my-custom-rule';
import { mySecondCustomRule } from './rules/my-second-custom-rule';
module.exports = {
rules: {
'some-custom-rule-name': myCustomRule,
'another-custom-rule-name': mySecondCustomRule,
},
};
Now you can include these rules into your eslint configuration by adding @bitovi/nx-glue
to your plugins and listing which rules you want to use within overrides
:
// .eslintrc
{
"plugins": ["@bitovi/nx-glue"],
"overrides": [
{
"files": ["*.ts"],
"rules": {
"@bitovi/nx-glue/my-plugin/some-custom-rule-name": "error",
"@bitovi/nx-glue/my-plugin/another-custom-rule-name": "warn"
}
}
]
}
Listed below is a detailed explaination of how the eslint-plugin-glue
configuration schema affects how you can consume your custom rules:
// eslint-plugin-nx-glue.config.js
module.exports = {
'<plugin-name>': {
dir: 'path/to/rules/from/root/of/project',
tsconfig: 'path/to/tsconfig/from/root/of/project/tsconfig.json',
},
'<plugin-name-2>': {
dir: 'path/to/rules/from/root/of/project',
tsconfig: 'path/to/tsconfig/from/root/of/project/tsconfig.json',
},
// ...
};
Configuration schema:
plugin-name
: Used to distinguish each plugin. This allows for plugins to have the same named rules within the same project.dir
: Path to index.ts
from root of project. This is the location of the exported ESLint Plugin.tsconfig
: Path to TypeScript configuration from root of project.This allows you to consume your custom rules exported by your local ESLint Plugins:
// .eslintrc
{
"plugins": ["@bitovi/nx-glue"],
"overrides": [
{
"files": ["..."],
"rules": {
"@bitovi/nx-glue/<plugin-name>/<custom-rule-name>": "...",
"@bitovi/nx-glue/<plugin-name>/<custom-rule-name-2>": "...",
"@bitovi/nx-glue/<plugin-name-2>/<another-custom-rule-name>": "..."
}
}
]
}
If you are using VSCode's ESLint extention, you will have to restart your ESLint server whenever you make changes to your ESLint Plugin(s). You can quickly restart your ESLint server by using the Command Palette and selecting ESLint: Restart ESLint Server
.
You can set path to your eslint-plugin-glue
configuration by setting ESLINT_PLUGIN_GLUE_CONFIG_PATH
environment variable. By default, eslint-plugin-glue configuration is expected to be at the root of your project and to be named eslint-plugin-glue.config.js
.
FAQs
Allows local ESLint Rules written in TypeScript to be available within Nx workspace
We found that @bitovi/eslint-plugin-nx-glue demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 15 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.