@bitwisedesign/xanoscriptlint 0.1.0

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.
Files changed (55) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +128 -0
  3. package/dist/cli.d.ts +6 -0
  4. package/dist/cli.d.ts.map +1 -0
  5. package/dist/cli.js +121 -0
  6. package/dist/cli.js.map +1 -0
  7. package/dist/config.d.ts +43 -0
  8. package/dist/config.d.ts.map +1 -0
  9. package/dist/config.js +239 -0
  10. package/dist/config.js.map +1 -0
  11. package/dist/customRules.d.ts +4 -0
  12. package/dist/customRules.d.ts.map +1 -0
  13. package/dist/customRules.js +43 -0
  14. package/dist/customRules.js.map +1 -0
  15. package/dist/discover.d.ts +7 -0
  16. package/dist/discover.d.ts.map +1 -0
  17. package/dist/discover.js +70 -0
  18. package/dist/discover.js.map +1 -0
  19. package/dist/lint.d.ts +14 -0
  20. package/dist/lint.d.ts.map +1 -0
  21. package/dist/lint.js +64 -0
  22. package/dist/lint.js.map +1 -0
  23. package/dist/report.d.ts +7 -0
  24. package/dist/report.d.ts.map +1 -0
  25. package/dist/report.js +86 -0
  26. package/dist/report.js.map +1 -0
  27. package/dist/rules/empty_function_run.d.ts +3 -0
  28. package/dist/rules/empty_function_run.d.ts.map +1 -0
  29. package/dist/rules/empty_function_run.js +32 -0
  30. package/dist/rules/empty_function_run.js.map +1 -0
  31. package/dist/rules/index.d.ts +5 -0
  32. package/dist/rules/index.d.ts.map +1 -0
  33. package/dist/rules/index.js +12 -0
  34. package/dist/rules/index.js.map +1 -0
  35. package/dist/rules/no_trailing_newline.d.ts +3 -0
  36. package/dist/rules/no_trailing_newline.d.ts.map +1 -0
  37. package/dist/rules/no_trailing_newline.js +34 -0
  38. package/dist/rules/no_trailing_newline.js.map +1 -0
  39. package/dist/rules/no_var_response.d.ts +3 -0
  40. package/dist/rules/no_var_response.d.ts.map +1 -0
  41. package/dist/rules/no_var_response.js +32 -0
  42. package/dist/rules/no_var_response.js.map +1 -0
  43. package/dist/rules/types.d.ts +30 -0
  44. package/dist/rules/types.d.ts.map +1 -0
  45. package/dist/rules/types.js +2 -0
  46. package/dist/rules/types.js.map +1 -0
  47. package/dist/suppress.d.ts +8 -0
  48. package/dist/suppress.d.ts.map +1 -0
  49. package/dist/suppress.js +107 -0
  50. package/dist/suppress.js.map +1 -0
  51. package/dist/util.d.ts +9 -0
  52. package/dist/util.d.ts.map +1 -0
  53. package/dist/util.js +37 -0
  54. package/dist/util.js.map +1 -0
  55. package/package.json +65 -0
package/dist/util.js ADDED
@@ -0,0 +1,37 @@
1
+ import { realpathSync } from "node:fs";
2
+ import path from "node:path";
3
+ export function isCommentLine(line) {
4
+ return line.trimStart().startsWith("//");
5
+ }
6
+ export function isBlankLine(line) {
7
+ return line.trim().length === 0;
8
+ }
9
+ export function splitLines(text) {
10
+ return text.split(/\r?\n/);
11
+ }
12
+ export function lineNumberOfOffset(text, offset) {
13
+ let line = 1;
14
+ let column = 1;
15
+ for (let i = 0; i < offset && i < text.length; i += 1) {
16
+ if (text[i] === "\n") {
17
+ line += 1;
18
+ column = 1;
19
+ }
20
+ else if (text[i] !== "\r") {
21
+ column += 1;
22
+ }
23
+ }
24
+ return { line, column };
25
+ }
26
+ export function isMainModule(argv1, modulePath) {
27
+ if (!argv1) {
28
+ return false;
29
+ }
30
+ try {
31
+ return realpathSync(argv1) === realpathSync(modulePath);
32
+ }
33
+ catch {
34
+ return path.resolve(argv1) === path.resolve(modulePath);
35
+ }
36
+ }
37
+ //# sourceMappingURL=util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,MAAM,UAAU,aAAa,CAAC,IAAY;IACxC,OAAO,IAAI,CAAC,SAAS,EAAE,CAAC,UAAU,CAAC,IAA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+ "version": "0.1.0",
4
+ "description": "A linter for XanoScript",
5
+ "type": "module",
6
+ "publishConfig": {
7
+ "access": "public"
8
+ },
9
+ "engines": {
10
+ "node": ">=20"
11
+ },
12
+ "bin": {
13
+ "xanoscriptlint": "dist/cli.js"
14
+ },
15
+ "main": "./dist/lint.js",
16
+ "exports": {
17
+ ".": "./dist/lint.js"
18
+ },
19
+ "files": [
20
+ "dist",
21
+ "LICENSE",
22
+ "README.md"
23
+ ],
24
+ "scripts": {
25
+ "build": "tsc -p tsconfig.build.json && chmod +x dist/cli.js",
26
+ "test": "tsc --noEmit && tsx --test test/*.test.ts",
27
+ "lint": "npm run lint:ts && npm run lint:md",
28
+ "lint:ts": "eslint .",
29
+ "lint:ts:fix": "eslint . --fix",
30
+ "lint:md": "markdownlint-cli2 --config .markdownlint.yaml \"**/*.md\" \"!node_modules/**\"",
31
+ "lint:md:fix": "markdownlint-cli2 --fix --config .markdownlint.yaml \"**/*.md\" \"!node_modules/**\"",
32
+ "prepare": "npm run build"
33
+ },
34
+ "repository": {
35
+ "type": "git",
36
+ "url": "git+https://github.com/bitwisedesign/xanoscriptlint.git"
37
+ },
38
+ "keywords": [
39
+ "xano",
40
+ "xanoscript",
41
+ "lint",
42
+ "linter"
43
+ ],
44
+ "author": "Bitwise Design",
45
+ "license": "MIT",
46
+ "bugs": {
47
+ "url": "https://github.com/bitwisedesign/xanoscriptlint/issues"
48
+ },
49
+ "homepage": "https://github.com/bitwisedesign/xanoscriptlint#readme",
50
+ "dependencies": {
51
+ "commander": "^15.0.0",
52
+ "picomatch": "^4.0.2",
53
+ "yaml": "^2.8.1"
54
+ },
55
+ "devDependencies": {
56
+ "@eslint/js": "^10.0.1",
57
+ "@types/node": "^24.3.0",
58
+ "@types/picomatch": "^4.0.3",
59
+ "eslint": "^10.9.1",
60
+ "markdownlint-cli2": "^0.23.2",
61
+ "tsx": "^4.20.5",
62
+ "typescript": "^5.9.2",
63
+ "typescript-eslint": "^8.69.0"
64
+ }
65
+ }