Skip to content

Instantly share code, notes, and snippets.

@pubudu-ranasinghe
Created November 8, 2019 12:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pubudu-ranasinghe/c4fed4767612601ee43eb4b8792f2488 to your computer and use it in GitHub Desktop.
Save pubudu-ranasinghe/c4fed4767612601ee43eb4b8792f2488 to your computer and use it in GitHub Desktop.
airbnb eslint errors to warnings
import react from "../node_modules/eslint-config-airbnb-base/rules/strict.js";
function isError(config) {
if(Array.isArray(config)) {
if(config[0] === 2 || config[0] === "error") {
return config;
}
}
if (config === 2 || config === "error")
return config;
return null;
}
let count = 0;
Object.keys(react.rules).forEach((k, i) => {
if(isError(react.rules[k])) {
count++
console.log(`"${k}": "warn",`)
}
})
console.log(count);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment