Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
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.
@locker/eslint-rule-maker
Advanced tools
Lightning Web Security ESLint rule maker utilities
$ yarn add @locker/eslint-rule-maker
Define a rule using createRule(config)
.
const { createRule, matchers } = require('@locker/eslint-rule-maker');
module.exports = createRule({
rule: {
// The message provided to `context.report()`.
message: 'Use of window.top is prohibited.',
// The array of object property paths to search for.
search: ['window.top'],
// The optional fix function or string provided to `context.report()`.
// https://eslint.org/docs/developer-guide/working-with-rules#contextreport
fix: 'window',
// The optional meta object.
// https://eslint.org/docs/developer-guide/working-with-rules#rule-basics
meta: {
// The following default values are provided:
// fixable: 'code' (when specifying `rule.fix`)
// type: 'problem'
},
// Choose an optional match handler from the exported `matchers` object
// or specify a custom one. The following `matchers` are available:
// - `matchers.matchAsNonReadableNonWritable` (default)
// Reports access or assignments to matches.
//
// - `matchers.matchAsNonWritable`
// Reports assignments to matches.
//
// - `matchers.matchAsNullishAndNonWritable`
// Reports property access on, or assignments to, matches.
//
// Matchers are passed a match `data` object and should return a
// boolean indicating whether the match succeeded. Match `data` contains
// the following properties:
// - `data.context`
// The ESLint rule context object.
// https://eslint.org/docs/developer-guide/working-with-rules#the-context-object
//
// - `data.identifier`
// The matched identifier node, e.g. representing `top`.
//
// - `data.node`
// The matched node, e.g. representing `window.top`.
//
// - `data.pattern`
// The matched search pattern, e.g. 'window.top'.
onMatch: matchers.matchAsNullishAndNonWritable,
},
});
FAQs
Lightning Web Security ESLint rule maker utilities
The npm package @locker/eslint-rule-maker receives a total of 3,904 weekly downloads. As such, @locker/eslint-rule-maker popularity was classified as popular.
We found that @locker/eslint-rule-maker demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 8 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
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.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.