@mehshekari/gsap-motion 3.0.0 → 3.1.1
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/NOTICE.md +59 -0
- package/README.md +4 -1
- package/package.json +1 -1
- package/skill/NOTICE.md +59 -0
- package/skill/SKILL.md +1 -1
- package/skill/scripts/audit-gsap.mjs +49 -50
- package/skill/scripts/lib/ast.mjs +527 -0
- package/skill/scripts/lib/audit.mjs +91 -0
- package/skill/scripts/lib/rules.mjs +890 -441
- package/skill/scripts/lib/source.mjs +79 -105
- package/skill/scripts/lib/vendor/parser.mjs +15 -0
package/NOTICE.md
CHANGED
|
@@ -3,6 +3,65 @@
|
|
|
3
3
|
This skill — its instructions, references, presets, examples, templates and
|
|
4
4
|
scripts — is released under the MIT License. See [LICENSE](LICENSE).
|
|
5
5
|
|
|
6
|
+
## Third-party code in the audit
|
|
7
|
+
|
|
8
|
+
`scripts/lib/vendor/parser.mjs` bundles two MIT-licensed packages, so the audit
|
|
9
|
+
can read JavaScript and TypeScript without installing anything. It is generated
|
|
10
|
+
from the versions its first lines name.
|
|
11
|
+
|
|
12
|
+
### acorn
|
|
13
|
+
|
|
14
|
+
```text
|
|
15
|
+
MIT License
|
|
16
|
+
|
|
17
|
+
Copyright (C) 2012-2022 by various contributors (see AUTHORS)
|
|
18
|
+
|
|
19
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
20
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
21
|
+
in the Software without restriction, including without limitation the rights
|
|
22
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
23
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
24
|
+
furnished to do so, subject to the following conditions:
|
|
25
|
+
|
|
26
|
+
The above copyright notice and this permission notice shall be included in
|
|
27
|
+
all copies or substantial portions of the Software.
|
|
28
|
+
|
|
29
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
30
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
31
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
32
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
33
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
34
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
35
|
+
THE SOFTWARE.
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### @sveltejs/acorn-typescript
|
|
39
|
+
|
|
40
|
+
```text
|
|
41
|
+
MIT License
|
|
42
|
+
|
|
43
|
+
Copyright (c) 2022 Tyreal Hu
|
|
44
|
+
Copyright (c) 2025 The Svelte Team
|
|
45
|
+
|
|
46
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
47
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
48
|
+
in the Software without restriction, including without limitation the rights
|
|
49
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
50
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
51
|
+
furnished to do so, subject to the following conditions:
|
|
52
|
+
|
|
53
|
+
The above copyright notice and this permission notice shall be included in all
|
|
54
|
+
copies or substantial portions of the Software.
|
|
55
|
+
|
|
56
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
57
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
58
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
59
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
60
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
61
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
62
|
+
SOFTWARE.
|
|
63
|
+
```
|
|
64
|
+
|
|
6
65
|
## GSAP is licensed separately
|
|
7
66
|
|
|
8
67
|
**GSAP is not part of this skill, and it is not MIT-licensed.** The code this
|
package/README.md
CHANGED
|
@@ -28,7 +28,7 @@ The audit needs no install. Pin the version, so a new rule cannot fail your
|
|
|
28
28
|
build without warning:
|
|
29
29
|
|
|
30
30
|
```json
|
|
31
|
-
"lint": "eslint && npx @mehshekari/gsap-motion@3.
|
|
31
|
+
"lint": "eslint && npx @mehshekari/gsap-motion@3.1.1 audit src --quiet"
|
|
32
32
|
```
|
|
33
33
|
|
|
34
34
|
Or install it with `npm install --save-dev --save-exact @mehshekari/gsap-motion`.
|
|
@@ -38,6 +38,9 @@ The command it adds is `gsap-motion`:
|
|
|
38
38
|
"lint": "eslint && gsap-motion audit src --quiet"
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
+
The same rules also run inside ESLint, so findings appear in your editor:
|
|
42
|
+
[`@mehshekari/eslint-plugin-gsap-motion`](https://www.npmjs.com/package/@mehshekari/eslint-plugin-gsap-motion).
|
|
43
|
+
|
|
41
44
|
## Claude Code plugin
|
|
42
45
|
|
|
43
46
|
The same skill is also a Claude Code plugin:
|
package/package.json
CHANGED
package/skill/NOTICE.md
CHANGED
|
@@ -3,6 +3,65 @@
|
|
|
3
3
|
This skill — its instructions, references, presets, examples, templates and
|
|
4
4
|
scripts — is released under the MIT License. See [LICENSE](LICENSE).
|
|
5
5
|
|
|
6
|
+
## Third-party code in the audit
|
|
7
|
+
|
|
8
|
+
`scripts/lib/vendor/parser.mjs` bundles two MIT-licensed packages, so the audit
|
|
9
|
+
can read JavaScript and TypeScript without installing anything. It is generated
|
|
10
|
+
from the versions its first lines name.
|
|
11
|
+
|
|
12
|
+
### acorn
|
|
13
|
+
|
|
14
|
+
```text
|
|
15
|
+
MIT License
|
|
16
|
+
|
|
17
|
+
Copyright (C) 2012-2022 by various contributors (see AUTHORS)
|
|
18
|
+
|
|
19
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
20
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
21
|
+
in the Software without restriction, including without limitation the rights
|
|
22
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
23
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
24
|
+
furnished to do so, subject to the following conditions:
|
|
25
|
+
|
|
26
|
+
The above copyright notice and this permission notice shall be included in
|
|
27
|
+
all copies or substantial portions of the Software.
|
|
28
|
+
|
|
29
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
30
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
31
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
32
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
33
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
34
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
35
|
+
THE SOFTWARE.
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### @sveltejs/acorn-typescript
|
|
39
|
+
|
|
40
|
+
```text
|
|
41
|
+
MIT License
|
|
42
|
+
|
|
43
|
+
Copyright (c) 2022 Tyreal Hu
|
|
44
|
+
Copyright (c) 2025 The Svelte Team
|
|
45
|
+
|
|
46
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
47
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
48
|
+
in the Software without restriction, including without limitation the rights
|
|
49
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
50
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
51
|
+
furnished to do so, subject to the following conditions:
|
|
52
|
+
|
|
53
|
+
The above copyright notice and this permission notice shall be included in all
|
|
54
|
+
copies or substantial portions of the Software.
|
|
55
|
+
|
|
56
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
57
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
58
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
59
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
60
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
61
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
62
|
+
SOFTWARE.
|
|
63
|
+
```
|
|
64
|
+
|
|
6
65
|
## GSAP is licensed separately
|
|
7
66
|
|
|
8
67
|
**GSAP is not part of this skill, and it is not MIT-licensed.** The code this
|
package/skill/SKILL.md
CHANGED
|
@@ -4,7 +4,7 @@ description: Senior motion engineer for GSAP. Turns a visual or interaction idea
|
|
|
4
4
|
license: MIT. See LICENSE; GSAP itself is licensed separately, see NOTICE.md
|
|
5
5
|
compatibility: Any Agent Skills client; written for Claude Code. GSAP 3.13+, where every plugin is free. React guidance targets @gsap/react 2.x, React 18/19 and the Next.js App Router. The audit scripts need Node.js 18+ and nothing else.
|
|
6
6
|
metadata:
|
|
7
|
-
version: "3.
|
|
7
|
+
version: "3.1.1"
|
|
8
8
|
verified-gsap: "3.15"
|
|
9
9
|
verified-gsap-react: "2.1"
|
|
10
10
|
---
|
|
@@ -13,10 +13,16 @@
|
|
|
13
13
|
* Rhythm, easing choice and whether an animation earns its place are not
|
|
14
14
|
* checkable and are not attempted — reference/motion-design.md owns those.
|
|
15
15
|
*
|
|
16
|
-
*
|
|
17
|
-
* and
|
|
18
|
-
*
|
|
19
|
-
*
|
|
16
|
+
* It reads each file's syntax tree — with a vendored parser, so nothing is
|
|
17
|
+
* installed — and follows what can be followed inside one file: aliases, a
|
|
18
|
+
* helper called only from a context, a timeline kept under a name. It does not
|
|
19
|
+
* follow calls into other files. A file it cannot parse is reported as
|
|
20
|
+
* `not-parsed`, never passed as clean. A wrong finding is a bug in this script;
|
|
21
|
+
* report it rather than working around it.
|
|
22
|
+
*
|
|
23
|
+
* What happens to each file — the rules, waivers, `not-parsed` — is in
|
|
24
|
+
* lib/audit.mjs, which the ESLint plugin runs too. This file finds the files,
|
|
25
|
+
* collects what they register between them, and prints.
|
|
20
26
|
*
|
|
21
27
|
* Usage — paths resolve from the current directory, so run it from the project
|
|
22
28
|
* root, wherever the skill itself is installed:
|
|
@@ -29,8 +35,9 @@
|
|
|
29
35
|
import { existsSync } from "node:fs";
|
|
30
36
|
import { resolve } from "node:path";
|
|
31
37
|
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
38
|
+
import { check, mentionsGsap, notParsed } from "./lib/audit.mjs";
|
|
39
|
+
import { pluginRegistrations, RULES } from "./lib/rules.mjs";
|
|
40
|
+
import { collect, load } from "./lib/source.mjs";
|
|
34
41
|
|
|
35
42
|
/**
|
|
36
43
|
* The project being audited is wherever this is run from, not wherever the
|
|
@@ -55,58 +62,50 @@ for (const path of paths) {
|
|
|
55
62
|
}
|
|
56
63
|
}
|
|
57
64
|
|
|
58
|
-
// --- Escape hatch ------------------------------------------------------------
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* The same shape many repos already use for their own lint waivers, on
|
|
62
|
-
* purpose: one way to say "yes, and here is why", not two.
|
|
63
|
-
*
|
|
64
|
-
* A hatch is the rule's own id plus `-ok`, on the flagged line or in the eight
|
|
65
|
-
* above it, and it waives that rule and nothing else — silencing a shared id
|
|
66
|
-
* cannot also silence a layout property on the same line. The lookback is eight
|
|
67
|
-
* because a reason usually stands above a whole declaration rather than beside
|
|
68
|
-
* one line of it.
|
|
69
|
-
*
|
|
70
|
-
* Every hatch must carry its reason. A bare token with no sentence after it is
|
|
71
|
-
* a rule someone turned off rather than answered, and once this gates a build
|
|
72
|
-
* that distinction has to stay visible in review.
|
|
73
|
-
*/
|
|
74
|
-
const LOOKBACK = 8;
|
|
75
|
-
|
|
76
|
-
function waived(source, line, ruleId) {
|
|
77
|
-
const lines = source.split("\n");
|
|
78
|
-
const from = Math.max(0, line - 1 - LOOKBACK);
|
|
79
|
-
return lines.slice(from, line).join("\n").includes(`${ruleId}-ok`);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
65
|
// --- Run ---------------------------------------------------------------------
|
|
83
66
|
|
|
84
67
|
const findings = [];
|
|
68
|
+
const sources = [];
|
|
69
|
+
|
|
70
|
+
/** A finding as the report shows it: under the file's display path, no column. */
|
|
71
|
+
const reported = (source, finding) => ({
|
|
72
|
+
rule: finding.rule,
|
|
73
|
+
level: finding.level,
|
|
74
|
+
file: source.display,
|
|
75
|
+
line: finding.line,
|
|
76
|
+
message: finding.message,
|
|
77
|
+
hint: finding.hint,
|
|
78
|
+
});
|
|
85
79
|
|
|
86
80
|
for (const path of paths) {
|
|
87
81
|
for (const file of collect(path)) {
|
|
88
82
|
const source = load(file, ROOT);
|
|
83
|
+
if (!mentionsGsap(source)) continue;
|
|
84
|
+
|
|
85
|
+
if (source.parseError) {
|
|
86
|
+
const finding = notParsed(source);
|
|
87
|
+
if (finding) findings.push(reported(source, finding));
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
sources.push(source);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Plugin registration is global: `gsap.registerPlugin(ScrollTrigger)` in one
|
|
97
|
+
* module registers it for every other. What the audited files register between
|
|
98
|
+
* them is collected before any rule runs, so a section that imports a plugin
|
|
99
|
+
* the app's entry registers is not reported as unregistered.
|
|
100
|
+
*/
|
|
101
|
+
const registered = new Set(sources.flatMap((source) => [...pluginRegistrations(source)]));
|
|
102
|
+
|
|
103
|
+
for (const source of sources) {
|
|
104
|
+
source.registeredElsewhere = registered;
|
|
89
105
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
*/
|
|
94
|
-
if (!source.usesGsap && !/\bgsap\./.test(source.code)) continue;
|
|
95
|
-
|
|
96
|
-
for (const rule of RULES) {
|
|
97
|
-
for (const hit of rule.test(source)) {
|
|
98
|
-
const line = lineAt(source.raw, hit.index);
|
|
99
|
-
if (waived(source.raw, line, rule.id)) continue;
|
|
100
|
-
|
|
101
|
-
findings.push({
|
|
102
|
-
rule: rule.id,
|
|
103
|
-
level: rule.level,
|
|
104
|
-
file: source.display,
|
|
105
|
-
line,
|
|
106
|
-
message: hit.message,
|
|
107
|
-
hint: hit.hint,
|
|
108
|
-
});
|
|
109
|
-
}
|
|
106
|
+
for (const rule of RULES) {
|
|
107
|
+
for (const finding of check(rule, source)) {
|
|
108
|
+
findings.push(reported(source, finding));
|
|
110
109
|
}
|
|
111
110
|
}
|
|
112
111
|
}
|