@checkdigit/eslint-plugin 7.18.0-PR.143-2d5f → 7.18.0-PR.143-7144
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/dist-mjs/athena/athena.mjs +17 -1
- package/dist-mjs/athena/service-table.mjs +3 -2
- package/dist-mjs/peggy/athena-peggy.mjs +2 -5
- package/package.json +1 -1
- package/src/athena/athena.ts +19 -0
- package/src/athena/service-table.ts +1 -0
- package/src/peggy/athena-peggy.ts +1 -4
- package/src/peggy/athena.peggy +1 -1
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@checkdigit/eslint-plugin","version":"7.18.0-PR.143-
|
|
1
|
+
{"name":"@checkdigit/eslint-plugin","version":"7.18.0-PR.143-7144","description":"Check Digit eslint plugins","keywords":["eslint","eslintplugin"],"homepage":"https://github.com/checkdigit/eslint-plugin#readme","bugs":{"url":"https://github.com/checkdigit/eslint-plugin/issues"},"repository":{"type":"git","url":"https://github.com/checkdigit/eslint-plugin"},"license":"MIT","author":"Check Digit, LLC","sideEffects":false,"type":"module","exports":{".":{"types":"./dist-types/index.d.ts","import":"./dist-mjs/index.mjs","default":"./dist-mjs/index.mjs"}},"files":["src","dist-types","dist-mjs","!src/**/test/**","!src/**/*.test.ts","!src/**/*.spec.ts","!dist-types/**/test/**","!dist-types/**/*.test.d.ts","!dist-types/**/*.spec.d.ts","!dist-mjs/**/test/**","!dist-mjs/**/*.test.mjs","!dist-mjs/**/*.spec.mjs","SECURITY.md"],"scripts":{"build:dist-mjs":"rimraf dist-mjs && npx builder --type=module --sourceMap --outDir=dist-mjs && node dist-mjs/index.mjs","build:dist-types":"rimraf dist-types && npx builder --type=types --outDir=dist-types","ci:compile":"tsc --noEmit","ci:coverage":"NODE_OPTIONS=\"--disable-warning ExperimentalWarning --experimental-vm-modules\" jest --coverage=true","ci:lint":"npm run lint","ci:style":"npm run prettier","ci:test":"NODE_OPTIONS=\"--disable-warning ExperimentalWarning --experimental-vm-modules\" jest --coverage=false","lint":"eslint --max-warnings 0 .","lint:fix":"eslint --max-warnings 0 --fix .","peggy":"for file in ./src/peggy/*.peggy; do peggy \"$file\" --format es --output \"${file%.peggy}-peggy.ts\"; done","peggy-watch":"for file in ./src/peggy/*.peggy; do peggy \"$file\" --format=es --watch --output=\"${file%.peggy}-peggy.ts\"; done","prepare":"","prepublishOnly":"npm run build:dist-types && npm run build:dist-mjs","prettier":"prettier --ignore-path .gitignore --list-different .","prettier:fix":"prettier --ignore-path .gitignore --write .","test":"npm run ci:compile && npm run ci:test && npm run ci:lint && npm run ci:style"},"prettier":"@checkdigit/prettier-config","jest":{"preset":"@checkdigit/jest-config"},"dependencies":{"@apidevtools/json-schema-ref-parser":"^15.3.5","@typescript-eslint/type-utils":"^8.60.1","@typescript-eslint/utils":"^8.60.1","ajv":"^8.20.0","debug":"^4.4.3","glob":"^13.0.6","http-status-codes":"^2.3.0","js-yaml":"^4.2.0","json-pointer":"^0.6.2","jsonpath-plus":"^10.4.0","ts-api-utils":"^2.5.0"},"devDependencies":{"@checkdigit/jest-config":"^6.0.2","@checkdigit/prettier-config":"^6.1.0","@checkdigit/typescript-config":"10.0.0","@eslint/js":"^9.37.0","@types/debug":"^4.1.13","@types/eslint":"^9.6.1","@types/eslint-config-prettier":"^6.11.3","@types/js-yaml":"^4.0.9","@types/json-pointer":"^1.0.34","@typescript-eslint/parser":"^8.60.1","@typescript-eslint/rule-tester":"^8.60.1","eslint":"^9.37.0","eslint-config-prettier":"^10.1.8","eslint-import-resolver-typescript":"^4.4.5","eslint-plugin-eslint-plugin":"^6.4.0","eslint-plugin-import":"^2.32.0","eslint-plugin-no-only-tests":"^3.4.0","eslint-plugin-no-secrets":"^2.3.3","eslint-plugin-node":"^11.1.0","eslint-plugin-sonarjs":"^1.0.4","openapi-types":"^12.1.3","peggy":"^4.2.0","rimraf":"^6.1.3","typescript-eslint":"^8.60.1"},"peerDependencies":{"eslint":">=9 <10"},"engines":{"node":">=22.18"},"service":{"api":{"root":"src","endpoints":["api/v1"]}},"wallaby":{"env":{"params":{"runner":"--experimental-vm-modules"}}}}
|
package/src/athena/athena.ts
CHANGED
|
@@ -162,6 +162,23 @@ function resolveServiceTable(select: Select, item: BaseFrom, ctx: VisitContext):
|
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
+
/** Remove inherited CTE tables that are not referenced in this SELECT's FROM clause. */
|
|
166
|
+
function restrictToFromClause(select: Select, ctx: VisitContext): void {
|
|
167
|
+
const fromNames = new Set<string>();
|
|
168
|
+
for (const item of fromClauseItems(select)) {
|
|
169
|
+
if (isBaseFrom(item) || isJoin(item)) {
|
|
170
|
+
fromNames.add(item.table);
|
|
171
|
+
} else if (isTableExpr(item)) {
|
|
172
|
+
fromNames.add(typeof item.as === 'string' ? item.as : '<subquery>');
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
for (const name of [...ctx.tables.keys()]) {
|
|
176
|
+
if (!fromNames.has(name)) {
|
|
177
|
+
ctx.tables.delete(name);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
165
182
|
function resolveFromClause(select: Select, ctx: VisitContext): void {
|
|
166
183
|
for (const item of fromClauseItems(select)) {
|
|
167
184
|
if (isUnnestFrom(item)) {
|
|
@@ -517,6 +534,8 @@ function checkSelect(selectAST: Select | With, ctx: VisitContext, withTableName?
|
|
|
517
534
|
|
|
518
535
|
// Pass 1: resolve FROM clause → populate selectCtx.tables + selectCtx.aliases
|
|
519
536
|
resolveFromClause(select, selectCtx);
|
|
537
|
+
// Drop inherited CTE tables not referenced in FROM so allTables stays scoped to this SELECT.
|
|
538
|
+
restrictToFromClause(select, selectCtx);
|
|
520
539
|
|
|
521
540
|
// UNNEST pre-pass: mappings whose source is a service-table column
|
|
522
541
|
const unnestMappings = extractUnnestMappings(select);
|
|
@@ -50,6 +50,7 @@ export function buildServiceTables(tableName: string, operations: MatchedOperati
|
|
|
50
50
|
['responsetype', [col('responsetype', SCHEMA_STRING)]],
|
|
51
51
|
['responsebody', [col('responsebody', bodySchema(operation.response, 'body'))]],
|
|
52
52
|
['responseheaders', [col('responseheaders', bodySchema(operation.response, 'headers'))]],
|
|
53
|
+
['partition_date', [col('partition_date', SCHEMA_STRING)]],
|
|
53
54
|
]),
|
|
54
55
|
}));
|
|
55
56
|
}
|
|
@@ -11757,10 +11757,7 @@ function peg$parse(input: any, options: any): any {
|
|
|
11757
11757
|
s1 = null;
|
|
11758
11758
|
}
|
|
11759
11759
|
s2 = peg$parse__();
|
|
11760
|
-
s3 = peg$
|
|
11761
|
-
if (s3 === peg$FAILED) {
|
|
11762
|
-
s3 = peg$parseor_and_expr();
|
|
11763
|
-
}
|
|
11760
|
+
s3 = peg$parseor_and_expr();
|
|
11764
11761
|
if (s3 !== peg$FAILED) {
|
|
11765
11762
|
s4 = peg$parse__();
|
|
11766
11763
|
s5 = [];
|
package/src/peggy/athena.peggy
CHANGED
|
@@ -2111,7 +2111,7 @@ distinct_args
|
|
|
2111
2111
|
orderby: or,
|
|
2112
2112
|
};
|
|
2113
2113
|
}
|
|
2114
|
-
/ d:KW_DISTINCT? __ c:
|
|
2114
|
+
/ d:KW_DISTINCT? __ c:or_and_expr __ tail:(__ (COMMA / OPERATOR_CONCATENATION) __ expr)* __ or:order_by_clause? {
|
|
2115
2115
|
const len = tail.length
|
|
2116
2116
|
let result = c
|
|
2117
2117
|
for (let i = 0; i < len; ++i) {
|