npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

eslint-audio-formatter

v0.1.3

Published

Audio formatter/reporter for EsLint to get a mp3 files with all the errors and warnings.

Downloads

8

Readme

eslint-audio-formatter

Audio formatter/reporter for EsLint to get a mp3 files with all the errors and warnings.

NPM Version Build Status

Motivation for this module

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:

  • Slack
  • HipChat
  • Twitter
  • Twilio...

The mp3 file is stored in a mp3-report-output folder at
the same root as the folder that contains the analyzed file.

  • All the errors are reported in natural language.

TODO - Implement internationalization on messages so that you can listen the messages in your own language.

Installation

Dependencies:

npm install eslint-audio-formatter --save-dev

Intellij/Webstorm/PhpStorm integration

  1. Install eslint and eslint-audio-formatter.

    npm install -D eslint eslint-audio-formatter
  2. 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/",
      }
    }
  3. Create a external tool to run eslint using this module as your formatter like this

    • program: npm
    • parameters: run eslint
    • working directory: $ProjectFileDir$
  4. Use an output filter like: (Please note the 2 spaces before $FILE_PATH$)

      $FILE_PATH$.*:$LINE$.*:$COLUMN$
  5. When launching the tool now the output files will be in the same level as the folder that contains the analyzed file.

Usage

In the command line

# just make sure you pass the path to the module to the format option of eslint
eslint --format './node_modules/eslint-audio-formatter/index.js' index.js

Or as a module

var eslint = require('eslint');
var opts = readJson('./path/to/options');

var engine = new eslint.CLIEngine( opts );
var report = engine.executeOnFiles( ['file1.js', 'file2.js'/*, ...*/] );
var results = report.results || [];

var formatter = require('eslint-audio-formatter');
formatter(results);

It works with gulp and gulp-eslint

var audioFormatter = require("eslint-audio-formatter");
// Your js task
gulp.task("javascript", function() {
  return gulp.src(["src/js/**/*.js"])
    // Your eslint pipe
    .pipe(eslint(".eslintrc"))
    .pipe(eslint.format(audioFormatter))
    // Continue your other tasks
    .pipe(concat("app.js"))
    .pipe(gulp.dest("dist/js"))
});

It should work well in with eslint-grunt or grunt-eslint

grunt.initConfig({
    // when using eslint-grunt:
    eslint: {
        options: {
            formatter: './node_modules/eslint-audio-formatter'
        }),
        target1: {
            //..
        }
    },
    // when using grunt-eslint:
    eslint: {
        options: {
            format: './node_modules/eslint-audio-formatter'
        }),
        target2: {
            //..
        }
    }
});

To get more information I recommend to read the use cases in tests.

Formatter parameters

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~~

Command line options

--eaf-voice

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 --

--eaf-speed

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.

Tests

To run the tests with NodeUnit:

npm install
npm test

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Check that it still works: npm test
  5. Push to the branch: git push origin my-new-feature
  6. Submit a pull request :D

History

0.1.0 - First release.

License

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.