File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ coverage
1212dist
1313dist-ssr
1414* .local
15+ playground /*
16+ ! playground /.gitkeep
1517
1618# Editor directories and files
1719.vscode /*
Original file line number Diff line number Diff line change @@ -50,3 +50,7 @@ export default defineConfig([
5050| ` php/eqeqeq ` | Require the use of ` === ` and ` !== ` | | |
5151| ` php/no-array-keyword ` | Disallow the use of the array keyword | 🔧 | |
5252| ` php/require-visibility ` | Require visibility for class methods and properties | | 💡 |
53+
54+ ## Development
55+
56+ Use ` npm run playground ` to lint local PHP files under the ` playground ` directory.
Original file line number Diff line number Diff line change 1+ /* eslint-disable no-console */
2+ import fs from 'fs' ;
3+ import { defineConfig } from 'eslint/config' ;
4+
5+ if ( ! fs . existsSync ( './dist/index.js' ) ) {
6+ console . error ( 'Please run `npm run build` before using the playground.' ) ;
7+
8+ process . exit ( 1 ) ;
9+ }
10+
11+ const phpFiles = fs
12+ . readdirSync ( './playground' )
13+ . filter ( ( file ) => file . endsWith ( '.php' ) ) ;
14+
15+ if ( phpFiles . length === 0 ) {
16+ console . error (
17+ 'Please add PHP files to `/playground` before using the playground.' ,
18+ ) ;
19+
20+ process . exit ( 1 ) ;
21+ }
22+
23+ const php = ( await import ( './dist/index.js' ) ) . default ;
24+
25+ export default defineConfig ( {
26+ files : [ './**/*.php' ] ,
27+ plugins : {
28+ php,
29+ } ,
30+ language : 'php/php' ,
31+ rules : {
32+ // TODO: Use recommended config.
33+ 'php/eqeqeq' : 'error' ,
34+ 'php/disallow-references' : 'error' ,
35+ 'php/no-array-keyword' : 'error' ,
36+ 'php/require-visibility' : 'error' ,
37+ } ,
38+ } ) ;
Original file line number Diff line number Diff line change 4040 "format" : " prettier --write ./" ,
4141 "format:check" : " prettier --check ./" ,
4242 "build" : " tsup" ,
43- "release" : " npm run build && changeset publish"
43+ "release" : " npm run build && changeset publish" ,
44+ "playground" : " eslint ./playground --config=eslint.config.playground.mjs"
4445 },
4546 "devDependencies" : {
4647 "@changesets/cli" : " ^2.27.7" ,
You can’t perform that action at this time.
0 commit comments