Audio formatter/reporter for EsLint to get a mp3 files with all the errors and warnings.
I decided to use eslint to verify my code and sadly there was no reporter to mp3. The idea of this report is to improve the accesibility of this report but not only for people with visual disability. Once you have the mp3 file you can use other robots:
The mp3 file is stored in a
the same root as the folder that contains the analyzed file.
TODO - Implement internationalization on messages so that you can listen the messages in your own language.
npm install eslint-audio-formatter --save-dev
npm install -D eslint eslint-audio-formatter
Add a script to your package json like:
"scripts":"eslint": "eslint --format 'node_modules/eslint-audio-formatter' file1 file2 dir1/ dir2/"
Note: In windows you might not need the quotes around the path to the module.
"scripts":"eslint": "eslint --format node_modules/eslint-audio-formatter file1 file2 dir1/ dir2/"
Create a external tool to run eslint using this module as your formatter like this
Use an output filter like: (Please note the 2 spaces before
When launching the tool now the output files will be in the same level as the folder that contains the analyzed file.
In the command line
# just make sure you pass the path to the module to the format option of eslinteslint --format './node_modules/eslint-audio-formatter/index.js' index.js
Or as a module
var eslint = ;var opts = ;var engine = opts ;var report = engine;var results = reportresults || ;var formatter = ;;
It works with
var audioFormatter = ;// Your js taskgulp;
It should work well in with eslint-grunt or grunt-eslint
To get more information I recommend to read the use cases in tests.
When executed with EsLint we can pass arguments to change the voice and speed.
To pass variables to the formatter you have to add a double dash at the end of the eslint command.
eslint --format './node_modules/eslint-audio-formatter' './test/data/with-syntax-errors.js' -- --eaf-voice=Vicki --eaf-speed=1
Eslint does not support passing parameters to formatters from the cli yet.So in order
to pass parameters to the formatter we will have to rely on environment variables
This option requires one of the available voices in say.js
eslint -f node_modules/eslint-audio-formatter client/**/*.js server/**/*.js -- --eaf-voice=Vicki # notice the --
This option changes the speed of the speech.
eslint -f node_modules/eslint-audio-formatter client/**/*.js server/**/*.js -- --eaf-speed=0.65 # notice the --
Important: don't forget to add the flag at the end and after
-- otherwise it will be interpreted as a eslint parameter and will fail as that parameter is not known to eslint.
To run the tests with NodeUnit:
npm installnpm test
git checkout -b my-new-feature
git commit -am 'Add some feature'
git push origin my-new-feature
0.1.0 - First release.
The MIT License (MIT)
Copyright (c) 2016 Tomás Corral
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.