Created
May 8, 2018 13:09
-
-
Save graingert/6f8732e1ff8b60c98b5173e8b16963fe to your computer and use it in GitHub Desktop.
eslint.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import json | |
| with open('./foo.json') as df: | |
| dump = json.load(df) | |
| for f in dump: | |
| fp = f['filePath'] | |
| rules = ', '.join(sorted(set(m['ruleId'] for m in f['messages']))) | |
| if not rules: | |
| continue | |
| with open(fp) as rf: | |
| content = rf.read() | |
| with open(fp, 'w') as wf: | |
| wf.write(f'/* eslint-disable {rules} */\n{content}') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment