@eagleoutice/eslint-config-flowr 2.1.6 → 2.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/index.js +13 -6
- package/package.json +1 -1
- package/patterns.js +6 -6
package/README.md
CHANGED
|
@@ -80,7 +80,7 @@ The shipped set groups into families:
|
|
|
80
80
|
| family | shape it finds | helper it points at |
|
|
81
81
|
| :-- | :-- | :-- |
|
|
82
82
|
| `edge-*` | `e.types === T`, `(e.types & T) !== 0`, and the bitmask spellings around them | `DfEdge` |
|
|
83
|
-
| `vertex-is*`, `vertex-has-origin` | `v.tag === VertexType.X`, `
|
|
83
|
+
| `vertex-is*`, `vertex-has-origin` | `v.tag === VertexType.X`, `DfgVertex.isFunctionCall(v) && v.origin.includes(o)` | `DfgVertex` |
|
|
84
84
|
| `node-is*` | `n.type === RType.X`, negated and through `?.` | `RSymbol`, `RFunctionCall`, and the rest of the `R*` node objects |
|
|
85
85
|
| `argument-is-*`, `call-is-*`, `list-is-implicit` | a guard written out, `RFunctionCall.is(n) && n.named` | the narrower guard of the same object |
|
|
86
86
|
| `symbol-name-comparison*` | `symbol.content === 'name'`, which misses `pkg::name` because an identifier with a namespace is an array | `Identifier.getName` / `Identifier.matches` |
|
package/index.js
CHANGED
|
@@ -105,14 +105,21 @@ const config = [
|
|
|
105
105
|
'@stylistic/no-extra-semi': 'error',
|
|
106
106
|
'jsdoc/check-alignment': 'error',
|
|
107
107
|
/*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
108
|
+
* `jsdoc/check-line-alignment` is deliberately NOT enabled. Lining up what the tags declare reads
|
|
109
|
+
* well, but 'always' reaches past the tags: it re-flows every hand-wrapped line to the margin, and
|
|
110
|
+
* that indentation is the author's and carries meaning -- a `@param` description hung under its
|
|
111
|
+
* first line, or the nested call in an R example that only its indentation ties to the call around
|
|
112
|
+
* it:
|
|
110
113
|
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
+
* ```r
|
|
115
|
+
* test_that("my test", {
|
|
116
|
+
* assert_equal(1 + 1, 2)
|
|
117
|
+
* })
|
|
118
|
+
* ```
|
|
119
|
+
*
|
|
120
|
+
* Neither `preserveMainDescriptionPostDelimiter` nor `disableWrapIndent` stops it doing that to a
|
|
121
|
+
* tag's continuation lines, so the alignment is left to the author, like the delimiter style is.
|
|
114
122
|
*/
|
|
115
|
-
'jsdoc/check-line-alignment': ['error', 'always', { disableWrapIndent: true }],
|
|
116
123
|
/* `@param name - what it is`, the spelling the codebase already uses everywhere */
|
|
117
124
|
'jsdoc/require-hyphen-before-param-description': ['error', 'always'],
|
|
118
125
|
'jsdoc/no-multi-asterisks': 'error',
|
package/package.json
CHANGED
package/patterns.js
CHANGED
|
@@ -84,12 +84,12 @@ const discriminatorIs = (id, { property, enumName, enumFile, propertyFile, helpe
|
|
|
84
84
|
};
|
|
85
85
|
};
|
|
86
86
|
/**
|
|
87
|
-
* `v.tag === VertexType.X`. One `
|
|
88
|
-
* enum, so `{{type|last}}` spells the check without a table: `VertexType.Use` to `
|
|
87
|
+
* `v.tag === VertexType.X`. One `DfgVertex` helper answers for every kind, and its members are named after
|
|
88
|
+
* the enum, so `{{type|last}}` spells the check without a table: `VertexType.Use` to `DfgVertex.isUse`.
|
|
89
89
|
*/
|
|
90
90
|
const vertexIs = (id, options) => discriminatorIs(id, {
|
|
91
91
|
property: 'tag', enumName: 'VertexType', enumFile: VERTEX, propertyFile: VERTEX,
|
|
92
|
-
helper: '
|
|
92
|
+
helper: 'DfgVertex', member: 'is{{type|last}}', hint: 'Compare through the vertex helper'
|
|
93
93
|
}, options);
|
|
94
94
|
/**
|
|
95
95
|
* `n.type === RType.X`. Every `RType` member has a helper object of the same name prefixed with `R`
|
|
@@ -220,15 +220,15 @@ const patterns = [
|
|
|
220
220
|
{
|
|
221
221
|
id: 'vertex-has-origin',
|
|
222
222
|
selector: 'LogicalExpression[operator="&&"]'
|
|
223
|
-
+ `${helperCall('left', '
|
|
223
|
+
+ `${helperCall('left', 'DfgVertex', 'isFunctionCall')}`
|
|
224
224
|
+ `${call('right', 'includes')}[right.callee.object.type="MemberExpression"][right.callee.object.property.name="origin"]`,
|
|
225
225
|
capture: { vertex: 'left.arguments.0', origin: 'right.arguments.0' },
|
|
226
|
-
replace: '
|
|
226
|
+
replace: 'DfgVertex.hasOrigin({{vertex}}, {{origin}})',
|
|
227
227
|
declaredIn: { 'left.callee.object': VERTEX, 'right.callee.object.property': VERTEX },
|
|
228
228
|
sameText: [['left.arguments.0', 'right.callee.object.object']],
|
|
229
229
|
/* `hasOrigin` is no type predicate, so the replacement can drop a narrowing the code below relies on */
|
|
230
230
|
fix: false,
|
|
231
|
-
message: 'Use `
|
|
231
|
+
message: 'Use `DfgVertex.hasOrigin`, it is exactly this check. Check the narrowing first, `hasOrigin` returns a plain boolean.'
|
|
232
232
|
},
|
|
233
233
|
edgesFallback('graph-edges-from', 'outgoingEdges', 'edgesFrom'),
|
|
234
234
|
edgesFallback('graph-edges-to', 'ingoingEdges', 'edgesTo'),
|