Skip to content

Commit d92ecf7

Browse files
authored
Merge pull request #2960 from Strategy11/docs/address-feedback-windsurf-rules
Address feedback and refactor Windsurf rules for Formidable patterns
2 parents 2f901de + 7d7cf32 commit d92ecf7

298 files changed

Lines changed: 10652 additions & 6482 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintignore

Lines changed: 0 additions & 27 deletions
This file was deleted.

.eslintrc.json

Lines changed: 0 additions & 229 deletions
This file was deleted.

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
.php-cs-fixer.cache export-ignore
1818
.wp-env.json export-ignore
1919
.coderabbit.yaml export-ignore
20+
.windsurf export-ignore
2021
cypress.config.js export-ignore
2122
/bin/ export-ignore
2223
changelog.txt export-ignore
@@ -45,6 +46,7 @@ mago.toml export-ignore
4546
/resources/ export-ignore
4647
webpack.dev.js export-ignore
4748
.browserslistrc export-ignore
49+
/eslint-rules/ export-ignore
4850
/phpcs-sniffs/ export-ignore
4951
.deepsource.toml export-ignore
5052
.semgrepignore export-ignore

.github/workflows/jscs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Set up Node.js
2020
uses: actions/setup-node@v5
2121
with:
22-
node-version: "20.10.0"
22+
node-version: "22"
2323

2424
- name: Cache dependencies
2525
id: cache-npm
@@ -34,7 +34,7 @@ jobs:
3434
3535
- name: Install dependencies
3636
if: steps.cache-npm.outputs.cache-hit != 'true'
37-
run: npm ci --include=dev
37+
run: npm ci --include=dev --legacy-peer-deps
3838

3939
- name: Run ESLint
4040
run: ./node_modules/.bin/eslint .

.github/workflows/stylelint.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Stylelint
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
types: [opened, labeled, synchronize]
9+
10+
jobs:
11+
runStylelintInspection:
12+
if: contains(github.event.pull_request.labels.*.name, 'run analysis')
13+
name: Run Stylelint
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v5
18+
19+
- name: Set up Node.js
20+
uses: actions/setup-node@v5
21+
with:
22+
node-version: "22"
23+
24+
- name: Cache dependencies
25+
id: cache-npm
26+
uses: actions/cache@v4
27+
with:
28+
path: |
29+
~/.npm
30+
node_modules
31+
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }}
32+
restore-keys: |
33+
${{ runner.os }}-node-modules-
34+
35+
- name: Install dependencies
36+
if: steps.cache-npm.outputs.cache-hit != 'true'
37+
run: npm ci --include=dev --legacy-peer-deps
38+
39+
- name: Run Stylelint
40+
run: npx stylelint "**/*.{css,scss}"

.stylelintrc.json

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
{
22
"extends": "@wordpress/stylelint-config/scss",
3+
"ignoreFiles": [
4+
"**/vendor/**",
5+
"**/node_modules/**",
6+
"**/web-components/**",
7+
"**/frm_admin.css",
8+
"**/frm-settings-components.css",
9+
"**/font_icons.css",
10+
"**/frm_testing_mode.css",
11+
"**/welcome-tour.css",
12+
"**/css/formidableforms.css"
13+
],
314
"rules": {
415
"no-descending-specificity": null,
516
"selector-class-pattern": null,
@@ -13,6 +24,12 @@
1324
"camelCaseSvgKeywords": true,
1425
"ignoreFunctions": ["currentColor"]
1526
}
16-
]
27+
],
28+
"color-named": null,
29+
"declaration-property-unit-allowed-list": null,
30+
"no-invalid-position-at-import-rule": null,
31+
"font-family-no-missing-generic-family-keyword": null,
32+
"scss/at-import-no-partial-leading-underscore": null,
33+
"scss/load-no-partial-leading-underscore": null
1734
}
1835
}

.windsurf/rules/enterprise/code-change-principles.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Critical principles for enterprise-level plugin development.
1616
3. **Backward compatibility**: Maintain 100% compatibility with existing callers
1717
4. **No custom solutions**: Never invent new patterns. Use existing ones or search the web to review best practices, then follow the official WordPress standards or VIP guidelines.
1818
5. **User changes are final**: If user makes manual changes, treat as authoritative
19+
6. **Multi-issue fixes**: When fixing multiple issues in one request, run all 6 phases independently for each issue. Findings from one issue's phases may inform the next, but every phase is mandatory for every issue, even when issues share a root cause.
1920

2021
---
2122

@@ -40,6 +41,7 @@ Before proposing solutions:
4041
- Trace execution flow from entry point to failure
4142
- **Analyze complete context** of the class or file being changed — all features, logic, and flows
4243
- **Trace parent hierarchy**: search parent classes and files up to plugin root
44+
- **CSS-Specific Rules - Trace complete style cascade**: When debugging CSS on an element, identify ALL classes on the element and its ancestors, then search for ALL CSS rules affecting it (not just the obvious class). Understand the complete cascade before proposing changes
4345
- Identify ALL affected locations in the codebase
4446
- Map dependencies: what calls this code, what does this code call
4547
- Check plugin requirements: must code work standalone or require Pro/addons
@@ -78,6 +80,8 @@ Before proposing solutions:
7880
- Never refactor unrelated code in the same commit
7981
- If a rule conflicts with existing code in the file being modified, follow the rule for new code but do not refactor unrelated existing code
8082
- Make the smallest change that completely solves the problem
83+
- **CSS-Specific Rules - Never modify shared CSS classes**: If a CSS class is already used elsewhere in the plugin, do not change its behavior. Instead, add a new specific class for the feature and define new styles for it
84+
- Use Big-O to compare algorithms and choose the most efficient one for large inputs and iterations
8185
- Never change method signatures, return types, or data structures
8286
- Add defensive checks where data comes in, not where used everywhere
8387
- Add PHPDoc/JSDoc for new methods/properties/functions and comments for complex logic

0 commit comments

Comments
 (0)