{"id":44096,"library":"ut-tsql-lexer","title":"ut-tsql-lexer","description":"Transact SQL lexer and linter that parses T-SQL source code into tokens and provides linting rules for code style and correctness. Version 1.5.4 is stable with moderate release cadence. It returns parsed tokens per line with types (whitespace, keyword, operator, etc.) and a lint array with rule violations. Key differentiators: built-in lint rules for uppercase keywords, indentation, whitespace, and quoting; detailed error messages with location.","status":"active","version":"1.5.4","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/softwaregroup-bg/ut-tsql-lexer","tags":["javascript"],"install":[{"cmd":"npm install ut-tsql-lexer","lang":"bash","label":"npm"},{"cmd":"yarn add ut-tsql-lexer","lang":"bash","label":"yarn"},{"cmd":"pnpm add ut-tsql-lexer","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The package only exports a named function 'parse', not a default export.","wrong":"const parse = require('ut-tsql-lexer')","symbol":"parse","correct":"import { parse } from 'ut-tsql-lexer'"},{"note":"CommonJS require destructuring is correct; do not misspell function name.","wrong":"const pars = require('ut-tsql-lexer').pars","symbol":"parse","correct":"const { parse } = require('ut-tsql-lexer')"},{"note":"parse() returns an object with lint array and tokens array; tokens is an array of arrays (lines of tokens).","wrong":"const parsed = parse(sql); parsed.lint.forEach(...)","symbol":"parse result","correct":"const result = parse(sql); const { lint, tokens } = result;"}],"quickstart":{"code":"const { parse } = require('ut-tsql-lexer');\nconst sql = 'SELECT * FROM someTable';\ntry {\n    const result = parse(sql);\n    // Lint warnings\n    result.lint.forEach(w => console.log(w.message));\n    // Tokens per line\n    result.tokens.forEach(line => {\n        line.forEach(t => console.log(t.type, t.text));\n    });\n} catch (err) {\n    console.error(err.message, err.location);\n}","lang":"javascript","description":"Demonstrates parsing T-SQL source code, accessing lint warnings, and iterating tokens per line with error handling."},"warnings":[{"fix":"Always iterate tokens as result.tokens.forEach(line => ...) and assume line is an array.","message":"parse() returns {lint, tokens} where tokens is an array of arrays (each inner array represents a line of tokens).","severity":"gotcha","affected_versions":"<2.0.0"},{"fix":"Wrap parse() in try-catch block.","message":"The parse function throws on syntax errors; catch the exception to get detailed location info.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use the exact string 'upppercase-keywords' in configurations; future versions may fix the typo.","message":"Lint rules like 'upppercase-keywords' have typo in rule name (upppercase vs uppercase).","severity":"deprecated","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.5.4':29 'array':51 'built':58 'built-in':57 'cadenc':35 'code':16,24 'correct':27 'detail':69 'differenti':56 'error':70 'etc':47 'indent':65 'javascript':74 'key':55 'keyword':45,64 'lexer':4,7 'line':41 'lint':21,50,60 'linter':9 'locat':73 'messag':71 'moder':33 'oper':46 'pars':11,38 'per':40 'provid':20 'quot':68 'releas':34 'return':37 'rule':22,53,61 'sourc':15 'sql':6,14 'stabl':31 'style':25 't-sql':12 'token':18,39 'transact':5 'tsql':3 'type':43 'uppercas':63 'ut':2 'ut-tsql-lex':1 'version':28 'violat':54 'whitespac':44,66","created_at":"2026-06-05T17:02:58.139047+00:00","updated_at":"2026-06-05T17:02:58.139047+00:00","problems":[{"fix":"Use named import: import { parse } from 'ut-tsql-lexer'","cause":"Using default import (import parse from 'ut-tsql-lexer') instead of named import.","error":"TypeError: parse is not a function"},{"fix":"Wrap parse() in try-catch: try { const r = parse(sql); r.lint... } catch (e) { ... }","cause":"Not catching parse exception when SQL syntax is invalid.","error":"Cannot read property 'lint' of undefined"},{"fix":"Iterate as result.tokens.forEach(line => line.forEach(token => ...))","cause":"Assuming tokens is a flat array, but it's an array of arrays (lines).","error":"tokens.forEach is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/softwaregroup-bg/ut-tsql-lexer#readme","github":"ssh://git@github.com/softwaregroup-bg/ut-tsql-lexer","docs":null,"changelog":null,"pypi":null,"npm":"ut-tsql-lexer","openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-05","next_check":"2026-09-03","install_tag":null}}