@stylistic/eslint-plugin-plus
Advanced tools
Comparing version 2.6.2 to 2.6.3
'use strict'; | ||
var utils$1 = require('@typescript-eslint/utils'); | ||
var utils = require('./utils.js'); | ||
@@ -8,2 +7,3 @@ | ||
name: "indent-binary-ops", | ||
package: "plus", | ||
meta: { | ||
@@ -66,3 +66,3 @@ type: "layout", | ||
const lastTokenOfLineLeft = lastTokenOfLine(tokenLeft.loc.start.line); | ||
const needAdditionIndent = firstTokenOfLineLeft?.type === "Keyword" && !["typeof", "instanceof", "this"].includes(firstTokenOfLineLeft.value) || firstTokenOfLineLeft?.type === "Identifier" && firstTokenOfLineLeft.value === "type" && node.parent?.type === utils$1.AST_NODE_TYPES.TSTypeAliasDeclaration || [":", "[", "(", "<", "="].includes(lastTokenOfLineLeft?.value || "") || ["||", "&&"].includes(lastTokenOfLineLeft?.value || "") && node.loc.start.line === tokenLeft.loc.start.line && node.loc.start.column !== getIndentOfLine(node.loc.start.line).length; | ||
const needAdditionIndent = firstTokenOfLineLeft?.type === "Keyword" && !["typeof", "instanceof", "this"].includes(firstTokenOfLineLeft.value) || firstTokenOfLineLeft?.type === "Identifier" && firstTokenOfLineLeft.value === "type" && node.parent?.type === "TSTypeAliasDeclaration" || [":", "[", "(", "<", "="].includes(lastTokenOfLineLeft?.value || "") || ["||", "&&"].includes(lastTokenOfLineLeft?.value || "") && node.loc.start.line === tokenLeft.loc.start.line && node.loc.start.column !== getIndentOfLine(node.loc.start.line).length; | ||
const indentTarget = getIndentOfLine(tokenLeft.loc.start.line) + (needAdditionIndent ? indentStr : ""); | ||
@@ -69,0 +69,0 @@ const indentRight = getIndentOfLine(tokenRight.loc.start.line); |
@@ -6,3 +6,2 @@ 'use strict'; | ||
var typeNamedTupleSpacing = require('./type-named-tuple-spacing.js'); | ||
require('@typescript-eslint/utils'); | ||
require('./utils.js'); | ||
@@ -9,0 +8,0 @@ |
'use strict'; | ||
var utils = require('./utils.js'); | ||
require('@typescript-eslint/utils'); | ||
@@ -14,2 +13,3 @@ const PRESERVE_PREFIX_SPACE_BEFORE_GENERIC = /* @__PURE__ */ new Set([ | ||
name: "type-generic-spacing", | ||
package: "plus", | ||
meta: { | ||
@@ -16,0 +16,0 @@ type: "layout", |
'use strict'; | ||
var utils = require('./utils.js'); | ||
require('@typescript-eslint/utils'); | ||
@@ -9,2 +8,3 @@ const tupleRe = /^([\w$]+)(\s*)(\?\s*)?:(\s*)(.*)$/; | ||
name: "type-named-tuple-spacing", | ||
package: "plus", | ||
meta: { | ||
@@ -11,0 +11,0 @@ type: "layout", |
'use strict'; | ||
var utils = require('@typescript-eslint/utils'); | ||
function isObjectNotArray(obj) { | ||
return typeof obj === "object" && obj != null && !Array.isArray(obj); | ||
} | ||
function deepMerge(first = {}, second = {}) { | ||
const keys = new Set(Object.keys(first).concat(Object.keys(second))); | ||
return Array.from(keys).reduce((acc, key) => { | ||
const firstHasKey = key in first; | ||
const secondHasKey = key in second; | ||
const firstValue = first[key]; | ||
const secondValue = second[key]; | ||
if (firstHasKey && secondHasKey) { | ||
if (isObjectNotArray(firstValue) && isObjectNotArray(secondValue)) { | ||
acc[key] = deepMerge(firstValue, secondValue); | ||
} else { | ||
acc[key] = secondValue; | ||
} | ||
} else if (firstHasKey) { | ||
acc[key] = firstValue; | ||
} else { | ||
acc[key] = secondValue; | ||
} | ||
return acc; | ||
}, {}); | ||
} | ||
const createRule = utils.ESLintUtils.RuleCreator( | ||
(name) => `https://eslint.style/rules/plus/${name}` | ||
); | ||
function createRule({ | ||
name, | ||
package: pkg, | ||
create, | ||
defaultOptions = [], | ||
meta | ||
}) { | ||
return { | ||
create: (context) => { | ||
const optionsCount = Math.max(context.options.length, defaultOptions.length); | ||
const optionsWithDefault = Array.from( | ||
{ length: optionsCount }, | ||
(_, i) => { | ||
if (isObjectNotArray(context.options[i]) && isObjectNotArray(defaultOptions[i])) { | ||
return deepMerge(defaultOptions[i], context.options[i]); | ||
} | ||
return context.options[i] ?? defaultOptions[i]; | ||
} | ||
); | ||
return create(context, optionsWithDefault); | ||
}, | ||
defaultOptions, | ||
meta: { | ||
...meta, | ||
docs: { | ||
...meta.docs, | ||
url: `https://eslint.style/rules/${pkg}/${name}` | ||
} | ||
} | ||
}; | ||
} | ||
exports.createRule = createRule; |
{ | ||
"name": "@stylistic/eslint-plugin-plus", | ||
"version": "2.6.2", | ||
"type": "commonjs", | ||
"version": "2.6.3", | ||
"author": "Anthony Fu <anthonyfu117@hotmail.com>", | ||
@@ -42,8 +43,4 @@ "license": "MIT", | ||
"dependencies": { | ||
"@types/eslint": "^9.6.0", | ||
"@typescript-eslint/utils": "^8.0.0" | ||
"@types/eslint": "^9.6.0" | ||
}, | ||
"devDependencies": { | ||
"@typescript-eslint/rule-tester": "^8.0.0" | ||
}, | ||
"scripts": { | ||
@@ -50,0 +47,0 @@ "build": "rimraf dist && rollup --config=rollup.config.mts --configPlugin=rollup-plugin-esbuild", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16601
2
0
418
- Removed@typescript-eslint/utils@^8.0.0
- Removed@nodelib/fs.scandir@2.1.5(transitive)
- Removed@nodelib/fs.stat@2.0.5(transitive)
- Removed@nodelib/fs.walk@1.2.8(transitive)
- Removed@typescript-eslint/scope-manager@8.15.0(transitive)
- Removed@typescript-eslint/types@8.15.0(transitive)
- Removed@typescript-eslint/typescript-estree@8.15.0(transitive)
- Removed@typescript-eslint/utils@8.15.0(transitive)
- Removed@typescript-eslint/visitor-keys@8.15.0(transitive)
- Removedbrace-expansion@2.0.1(transitive)
- Removedbraces@3.0.3(transitive)
- Removedfast-glob@3.3.2(transitive)
- Removedfastq@1.17.1(transitive)
- Removedfill-range@7.1.1(transitive)
- Removedglob-parent@5.1.2(transitive)
- Removedis-number@7.0.0(transitive)
- Removedmerge2@1.4.1(transitive)
- Removedmicromatch@4.0.8(transitive)
- Removedminimatch@9.0.5(transitive)
- Removedpicomatch@2.3.1(transitive)
- Removedqueue-microtask@1.2.3(transitive)
- Removedreusify@1.0.4(transitive)
- Removedrun-parallel@1.2.0(transitive)
- Removedsemver@7.6.3(transitive)
- Removedto-regex-range@5.0.1(transitive)
- Removedts-api-utils@1.4.1(transitive)
- Removedtypescript@5.7.2(transitive)