tackbox 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.
- package/LICENSE +21 -0
- package/README.md +552 -0
- package/bin/tackbox-eslint.js +147 -0
- package/bin/tackbox-mdlint.js +45 -0
- package/eslint.config.preset.js +21 -0
- package/js/README.md +209 -0
- package/js/eslint-plugin.js +48 -0
- package/js/markdownlint-rules/no-non-ascii.js +132 -0
- package/js/report.js +187 -0
- package/js/rules/_shared.js +809 -0
- package/js/rules/no-broad-notify.js +47 -0
- package/js/rules/no-console-error.js +23 -0
- package/js/rules/no-focused-test.js +22 -0
- package/js/rules/no-parse-fallback.js +150 -0
- package/js/rules/no-skipped-test.js +95 -0
- package/js/rules/no-swallow-allsettled.js +52 -0
- package/js/rules/no-swallow-catch.js +31 -0
- package/js/rules/no-swallow-promise-catch.js +38 -0
- package/js/rules/no-throw-and-report.js +30 -0
- package/js/rules/ts-exit-in-catch.js +26 -0
- package/js/rules/ts-rethrow-without-cause.js +62 -0
- package/js/rules/ts-useless-catch.js +25 -0
- package/js/rules/valid-dedup-key.js +50 -0
- package/js/rules/valid-error-report.js +99 -0
- package/js/tests/eslint-wrapper.test.js +53 -0
- package/js/tests/mdlint-wrapper.test.js +85 -0
- package/js/tests/no-non-ascii.test.js +124 -0
- package/js/tests/report.test.js +182 -0
- package/js/tests/reporters.test.js +223 -0
- package/js/tests/rules.test.js +650 -0
- package/js/tests/svelte.test.js +61 -0
- package/package.json +43 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
const { test } = require('node:test')
|
|
2
|
+
const { RuleTester } = require('eslint')
|
|
3
|
+
const svelteParser = require('svelte-eslint-parser')
|
|
4
|
+
|
|
5
|
+
const ruleTester = new RuleTester({
|
|
6
|
+
languageOptions: { ecmaVersion: 2022, sourceType: 'module' },
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
const svelteOpts = { languageOptions: { parser: svelteParser } }
|
|
10
|
+
const IMP = "import { reportError } from 'tackbox/report'\n"
|
|
11
|
+
|
|
12
|
+
test('no-swallow-catch (Svelte)', () => {
|
|
13
|
+
ruleTester.run('no-swallow-catch', require('../rules/no-swallow-catch'), {
|
|
14
|
+
valid: [
|
|
15
|
+
{ code: '<script>\n' + IMP + 'try { f() } catch (e) { reportError("connection lost mid-stream", e) }\n</script>', ...svelteOpts },
|
|
16
|
+
],
|
|
17
|
+
invalid: [
|
|
18
|
+
{ code: '<script>\ntry { f() } catch (e) {}\n</script>', ...svelteOpts, errors: [{ messageId: 'swallow' }] },
|
|
19
|
+
],
|
|
20
|
+
})
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
// Svelte 5.3+ syntax the parser must handle; 0.43.x died here with
|
|
24
|
+
// "Unknown type: SvelteBoundary" on any rule run.
|
|
25
|
+
test('svelte:boundary parses (Svelte 5)', () => {
|
|
26
|
+
ruleTester.run('no-console-error', require('../rules/no-console-error'), {
|
|
27
|
+
valid: [
|
|
28
|
+
{
|
|
29
|
+
code: '<svelte:boundary onerror={(e) => f(e)}>\n<p>{x}</p>\n{#snippet failed(error)}<p>{error}</p>{/snippet}\n</svelte:boundary>',
|
|
30
|
+
...svelteOpts,
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
invalid: [],
|
|
34
|
+
})
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
test('no-console-error (Svelte)', () => {
|
|
38
|
+
ruleTester.run('no-console-error', require('../rules/no-console-error'), {
|
|
39
|
+
valid: [
|
|
40
|
+
{ code: '<script>\nconsole.log("hi")\n</script>', ...svelteOpts },
|
|
41
|
+
],
|
|
42
|
+
invalid: [
|
|
43
|
+
{ code: '<script>\nconsole.error("boom")\n</script>', ...svelteOpts, errors: [{ messageId: 'use' }] },
|
|
44
|
+
],
|
|
45
|
+
})
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
test('valid-error-report (Svelte)', () => {
|
|
49
|
+
ruleTester.run('valid-error-report', require('../rules/valid-error-report'), {
|
|
50
|
+
valid: [
|
|
51
|
+
{ code: '<script>\n' + IMP + 'reportError("connection lost mid-stream", err, null, "api.lost")\n</script>', ...svelteOpts },
|
|
52
|
+
],
|
|
53
|
+
invalid: [
|
|
54
|
+
{
|
|
55
|
+
code: '<script>\n' + IMP + 'reportError(`oops ${x}`, err, null, "api.lost")\n</script>',
|
|
56
|
+
...svelteOpts,
|
|
57
|
+
errors: [{ messageId: 'msgNotStatic' }],
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
})
|
|
61
|
+
})
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "tackbox",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "ESLint plugin + browser report helper: every failure must report, propagate, or explain itself.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"main": "./js/eslint-plugin.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./js/eslint-plugin.js",
|
|
9
|
+
"./report": "./js/report.js"
|
|
10
|
+
},
|
|
11
|
+
"bin": {
|
|
12
|
+
"tackbox-eslint": "./bin/tackbox-eslint.js",
|
|
13
|
+
"tackbox-mdlint": "./bin/tackbox-mdlint.js"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"js/",
|
|
17
|
+
"bin/",
|
|
18
|
+
"eslint.config.preset.js"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"test": "node --test js/tests/*.test.js"
|
|
22
|
+
},
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"eslint": ">=8"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@sentry/browser": "^8.0.0",
|
|
28
|
+
"@typescript-eslint/parser": "^8.0.0",
|
|
29
|
+
"markdownlint": "0.40.0",
|
|
30
|
+
"svelte": "^5.0.0",
|
|
31
|
+
"svelte-eslint-parser": "^1.6.0"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"eslint": "^9.0.0"
|
|
35
|
+
},
|
|
36
|
+
"repository": {
|
|
37
|
+
"type": "git",
|
|
38
|
+
"url": "https://github.com/nikitatsym/tackbox.git"
|
|
39
|
+
},
|
|
40
|
+
"engines": {
|
|
41
|
+
"node": ">=20"
|
|
42
|
+
}
|
|
43
|
+
}
|