GithubHelp home page GithubHelp logo

snanovskyi / eslint-to-editorconfig Goto Github PK

View Code? Open in Web Editor NEW
49.0 3.0 6.0 80 KB

Module for transforming configuration from ESLint to EditorConfig format

License: ISC License

JavaScript 100.00%

eslint-to-editorconfig's Introduction

eslint-to-editorconfig

npm Build Status License

Module for transforming configuration from ESLint to EditorConfig format.

Note that minimum supported version of eslint is 2.0.0.

Usage

You need to install eslint-to-editorconfig globally if you use npm 5.1 or earlier:

npm install -g eslint-to-editorconfig
cd project
eslint-to-editorconfig

Otherwise you can use npx:

cd project
npx eslint-to-editorconfig

For a complete list of available options run:

eslint-to-editorconfig --help

API

const transform = require('eslint-to-editorconfig');

// Take ESLint rules
const eslintRules = {
  indent: 'error',
  'no-trailing-spaces': 'error',
  'eol-last': 'error',
  'max-len': 'error',
};

// Transform them into EditorConfig rules
const editorConfigRules = transform(eslintRules);
console.log(editorConfigRules);

License

This library is released under the ISC license.

eslint-to-editorconfig's People

Contributors

snanovskyi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

eslint-to-editorconfig's Issues

airbnb config

Hi,
I'v tried running this against airbnb's config and got the following error:
/usr/local/lib/node_modules/eslint-to-editorconfig/node_modules/eslint/lib/config/config-file.js:332
throw e;
^

Error: /usr/local/lib/node_modules/eslint-config-airbnb/rules/best-practices.js:
Configuration for rule "no-labels" is invalid:
Value "2,[object Object]" has more items than allowed.

Any ideas?
/Stephen.

Upgrade eslint v2.x -> v3.x

I've run into errors like the following, and they appear to be due to using an outdated version of eslint

/path/to/project/node_modules/eslint-to-editorconfig/node_modules/eslint/lib/config/config-file.js:402
            throw e;
            ^

Error: /path/to/project/node_modules/eslint-config-airbnb-base/rules/es6.js:
	Configuration for rule "arrow-parens" is invalid:
	Value "as-needed,[object Object]" has more items than allowed.

Referenced from: airbnb-base
Referenced from: /path/to/project/.eslintrc

"ESLint configuration is invalid" when it's not

Running eslint-to-editorconfig outputs "ESLint configuration is invalid" without any additional information. However it is not invalid, as ESLint works fine, both CLI and IDE.

eslint-to-editorconfig version: 2.0.0
eslint version: 7.3.1
.eslintrc.js file:

module.exports = {
    "env": {
        "browser": true,
        "es2017": true,
        "node": true
    },
    "parser": "@typescript-eslint/parser",
    "parserOptions": {
        "project": "tsconfig.eslint.json",
        "sourceType": "module"
    },
    "plugins": [
        "@typescript-eslint",
        "import",
        "prefer-arrow"
    ],
    "rules": {
        // bunch of rules
    },
    "overrides": [
        {
            "files": ["*.spec.ts"],
            "env": {
                "jasmine": true
            },
            "rules": {
                // bunch of rule overrides
            }
        }
    ]
};

Error thowing on running eslint-editorconfig command

When I am running the command It is thowing following error. I have .eslintrc in my current directory

~/.npm-packages/lib/node_modules/eslint-to-editorconfig/index.js:43
  if (rules['max-len'][0] > 0) {
                      ^
TypeError: Cannot read property '0' of undefined
    at maxLineLength (~/.npm-packages/lib/node_modules/eslint-to-editorconfig/index.js:43:23)
    at rulesToProps (~/.npm-packages/lib/node_modules/eslint-to-editorconfig/index.js:72:3)
    at module.exports (~/.npm-packages/lib/node_modules/eslint-to-editorconfig/index.js:96:5)
    at Object.<anonymous> (~/.npm-packages/lib/node_modules/eslint-to-editorconfig/bin.js:5:1)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:501:10)
    at startup (node.js:129:16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.