File tree Expand file tree Collapse file tree 8 files changed +939
-0
lines changed
Expand file tree Collapse file tree 8 files changed +939
-0
lines changed Original file line number Diff line number Diff line change 1+ {
2+ "root" : true ,
3+ "parserOptions" : {
4+ "ecmaVersion" : 6 ,
5+ "sourceType" : " module" ,
6+ "ecmaFeatures" : {
7+ "jsx" : true
8+ }
9+ },
10+ "plugins" : [" react-hooks" ],
11+ "rules" : {
12+ "react-hooks/rules-of-hooks" : 2
13+ }
14+ }
Original file line number Diff line number Diff line change 1+ # ESLint Playground Fixture
2+
3+ This is an internal playground for quick iteration on our lint rules inside an IDE like VSCode.
4+
5+ See instructions in ` ./index.js ` in this directory.
6+
7+ ![ Demo] ( https://duaw26jehqd4r.cloudfront.net/items/2Z390a31003O0l0o0e3O/Screen%20Recording%202019-01-16%20at%2010.29%20PM.gif?v=d6856125 )
Original file line number Diff line number Diff line change 1+ // This is a testing playground for our lint rules.
2+
3+ // 1. Run yarn && yarn start
4+ // 2. "File > Add Folder to Workspace" this specific folder in VSCode with ESLint extension
5+ // 3. Changes to the rule source should get picked up without restarting ESLint server
6+
7+ function Foo ( ) {
8+ if ( condition ) {
9+ useEffect ( ( ) => { } ) ;
10+ }
11+ }
Original file line number Diff line number Diff line change 1+ {
2+ "private" : true ,
3+ "name" : " eslint-playground" ,
4+ "dependencies" : {
5+ "eslint" : " 4.1.0" ,
6+ "eslint-plugin-react-hooks" : " link:./proxy"
7+ },
8+ "scripts" : {
9+ "start" : " ./watch.sh" ,
10+ "lint" : " eslint index.js"
11+ }
12+ }
Original file line number Diff line number Diff line change 1+ 'use strict' ;
2+
3+ // This file is a proxy for our rule definition that will
4+ // load the latest built version on every check. This makes
5+ // it convenient to test inside IDEs (which would otherwise
6+ // load a version of our rule once and never restart the server).
7+ // See instructions in ../index.js playground.
8+
9+ let build ;
10+ reload ( ) ;
11+
12+ function reload ( ) {
13+ for ( let id in require . cache ) {
14+ if ( / e s l i n t - p l u g i n - r e a c t - h o o k s / . test ( id ) ) {
15+ delete require . cache [ id ] ;
16+ }
17+ }
18+ // Point to the built version.
19+ build = require ( '../../../build/node_modules/eslint-plugin-react-hooks' ) ;
20+ }
21+
22+ let rules = { } ;
23+ for ( let key in build . rules ) {
24+ if ( build . rules . hasOwnProperty ( key ) ) {
25+ rules [ key ] = Object . assign ( { } , build . rules , {
26+ create ( ) {
27+ // Reload changes to the built rule
28+ reload ( ) ;
29+ return build . rules [ key ] . create . apply ( this , arguments ) ;
30+ } ,
31+ } ) ;
32+ }
33+ }
34+
35+ module . exports = { rules} ;
Original file line number Diff line number Diff line change 1+ {
2+ "private" : true ,
3+ "version" : " 0.0.0"
4+ }
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ (cd ../.. && yarn build eslint --type=NODE_DEV)
3+ (cd ../.. && watchman-make --make ' yarn build eslint --type=NODE_DEV' -p ' packages/eslint-plugin-*/**/*' -t ignored)
You can’t perform that action at this time.
0 commit comments