├── .editorconfig ├── .gitattributes ├── .gitignore ├── .travis.yml ├── CHANGELOG.md ├── CONTRIBUTING.md ├── LICENSE.md ├── README.md ├── TODO.md ├── index.js ├── lib └── rules │ ├── block-scoped-var.js │ ├── brace-style.js │ ├── camelcase.js │ ├── comma-dangle.js │ ├── comma-spacing.js │ ├── comma-style.js │ ├── complexity.js │ ├── consistent-return.js │ ├── consistent-this.js │ ├── curly.js │ ├── default-case.js │ ├── dot-notation.js │ ├── eol-last.js │ ├── eqeqeq.js │ ├── func-names.js │ ├── func-style.js │ ├── generator-star.js │ ├── global-strict.js │ ├── guard-for-in.js │ ├── handle-callback-err.js │ ├── indent.js │ ├── index.js │ ├── key-spacing.js │ ├── max-depth.js │ ├── max-len.js │ ├── max-nested-callbacks.js │ ├── max-params.js │ ├── max-statements.js │ ├── new-cap.js │ ├── new-parens.js │ ├── newline-after-var.js │ ├── no-alert.js │ ├── no-array-constructor.js │ ├── no-bitwise.js │ ├── no-caller.js │ ├── no-catch-shadow.js │ ├── no-comma-dangle.js │ ├── no-cond-assign.js │ ├── no-console.js │ ├── no-constant-condition.js │ ├── no-control-regex.js │ ├── no-debugger.js │ ├── no-delete-var.js │ ├── no-div-regex.js │ ├── no-dupe-args.js │ ├── no-dupe-keys.js │ ├── no-duplicate-case.js │ ├── no-else-return.js │ ├── no-empty-class.js │ ├── no-empty-label.js │ ├── no-empty.js │ ├── no-eq-null.js │ ├── no-eval.js │ ├── no-ex-assign.js │ ├── no-extend-native.js │ ├── no-extra-bind.js │ ├── no-extra-boolean-cast.js │ ├── no-extra-parens.js │ ├── no-extra-semi.js │ ├── no-extra-strict.js │ ├── no-fallthrough.js │ ├── no-floating-decimal.js │ ├── no-func-assign.js │ ├── no-implied-eval.js │ ├── no-inline-comments.js │ ├── no-inner-declarations.js │ ├── no-invalid-regexp.js │ ├── no-irregular-whitespace.js │ ├── no-iterator.js │ ├── no-label-var.js │ ├── no-labels.js │ ├── no-lone-blocks.js │ ├── no-lonely-if.js │ ├── no-loop-func.js │ ├── no-mixed-requires.js │ ├── no-mixed-spaces-and-tabs.js │ ├── no-multi-str.js │ ├── no-native-reassign.js │ ├── no-negated-in-lhs.js │ ├── no-nested-ternary.js │ ├── no-new-func.js │ ├── no-new-object.js │ ├── no-new-require.js │ ├── no-new-wrappers.js │ ├── no-new.js │ ├── no-obj-calls.js │ ├── no-octal-escape.js │ ├── no-octal.js │ ├── no-param-reassign.js │ ├── no-path-concat.js │ ├── no-plusplus.js │ ├── no-process-env.js │ ├── no-process-exit.js │ ├── no-proto.js │ ├── no-redeclare.js │ ├── no-regex-spaces.js │ ├── no-reserved-keys.js │ ├── no-restricted-modules.js │ ├── no-return-assign.js │ ├── no-script-url.js │ ├── no-self-compare.js │ ├── no-sequences.js │ ├── no-shadow-restricted-names.js │ ├── no-shadow.js │ ├── no-space-before-semi.js │ ├── no-sparse-arrays.js │ ├── no-sync.js │ ├── no-ternary.js │ ├── no-throw-literal.js │ ├── no-undef-init.js │ ├── no-undef.js │ ├── no-undefined.js │ ├── no-underscore-dangle.js │ ├── no-unreachable.js │ ├── no-unused-expressions.js │ ├── no-unused-vars.js │ ├── no-use-before-define.js │ ├── no-var.js │ ├── no-void.js │ ├── no-warning-comments.js │ ├── no-with.js │ ├── no-wrap-func.js │ ├── one-var.js │ ├── operator-assignment.js │ ├── quote-props.js │ ├── quotes.js │ ├── radix.js │ ├── semi.js │ ├── sort-vars.js │ ├── space-after-function-name.js │ ├── space-before-function-parentheses.js │ ├── space-unary-word-ops.js │ ├── strict.js │ ├── use-isnan.js │ ├── valid-jsdoc.js │ ├── valid-typeof.js │ ├── vars-on-top.js │ ├── wrap-iife.js │ ├── wrap-regex.js │ └── yoda.js ├── package.json └── test ├── block-scoped-var.js ├── brace-style.js ├── camelcase.js ├── comma-spacing.js ├── eol-last.js ├── indent.js ├── key-spacing.js ├── lib └── test-rule.js └── newline-after-var.js /.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | 3 | root = true 4 | 5 | [*] 6 | charset = utf-8 7 | indent_style = space 8 | indent_size = 2 9 | end_of_line = lf 10 | insert_final_newline = true 11 | trim_trailing_whitespace = true 12 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text eol=lf 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | npm-debug.log 3 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - '0.12' 4 | - 'iojs' 5 | sudo: false 6 | cache: 7 | directories: 8 | - node_modules 9 | script: 10 | - npm test 11 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # eslint-to-esformatter change log 2 | 3 | All notable changes to this project will be documented in this file. 4 | This project adheres to [Semantic Versioning](http://semver.org/). 5 | 6 | ## Unreleased 7 | * engage 8 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Open-2 Contributing Guidelines 2 | 3 | **This is an OPEN Open Source Project.** 4 | 5 | ## What? 6 | 7 | Individuals making significant and valuable contributions are given commit-access to the project to contribute as they see fit. This project is more like an open wiki than a standard guarded open source project. 8 | 9 | ## Rules 10 | 11 | There are a few basic ground-rules for contributors: 12 | 13 | 1. **No `--force` pushes** or modifying the Git history in any way. 14 | 1. **Non-master branches** ought to be used for ongoing work. 15 | 1. **External API changes and significant modifications** ought to be subject to an **internal pull-request** to solicit feedback from other contributors. 16 | 1. Internal pull-requests to solicit feedback are *encouraged* for any other non-trivial contribution but left to the discretion of the contributor. 17 | 1. Contributors should attempt to adhere to the prevailing code style. 18 | 19 | ## Releases 20 | 21 | Declaring formal releases remains the prerogative of the project maintainer. 22 | 23 | ## Changes to this arrangement 24 | 25 | This is an experiment and feedback is welcome! This document may also be subject to pull-requests or changes by contributors where you believe you have something valuable to add or change. 26 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015, Dan Flettre 2 | 3 | Permission to use, copy, modify, and/or distribute this software for any 4 | purpose with or without fee is hereby granted, provided that the above 5 | copyright notice and this permission notice appear in all copies. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 8 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 9 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 10 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 11 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 12 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 13 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # eslint-to-esformatter - **WORK IN PROGRESS** 2 | 3 | [![npm][npm-image]][npm-url] 4 | [![travis][travis-image]][travis-url] 5 | 6 | [![js-semistandard-style](https://cdn.rawgit.com/Flet/semistandard/master/badge.svg)](https://github.com/Flet/semistandard) 7 | 8 | [npm-image]: https://img.shields.io/npm/v/eslint-to-esformatter.svg?style=flat-square 9 | [npm-url]: https://www.npmjs.com/package/eslint-to-esformatter 10 | [travis-image]: https://img.shields.io/travis/flet/eslint-to-esformatter.svg?style=flat-square 11 | [travis-url]: https://travis-ci.org/Flet/eslint-to-esformatter 12 | 13 | Convert .eslintrc into esformatter JSON. 14 | 15 | ## Install 16 | 17 | ``` 18 | npm install eslint-to-esformatter 19 | ``` 20 | 21 | ## Usage 22 | 23 | ```js 24 | var eslintToEsformatter = require('eslint-to-esformatter') 25 | ``` 26 | 27 | ## Contributing 28 | 29 | [Open-2](CONTRIBUTING.md) 30 | 31 | ## License 32 | 33 | [ISC](LICENSE.md) 34 | -------------------------------------------------------------------------------- /TODO.md: -------------------------------------------------------------------------------- 1 | ### TODOs 2 | | Filename | line # | TODO 3 | |:------|:------:|:------ 4 | | index.js | 17 | may need to sort rules in a specific order 5 | ### TODOs 6 | | Filename | line # | TODO 7 | |:------|:------:|:------ 8 | | lib/rules/block-scoped-var.js | 6 | support through esformatter-plugin? 9 | ### TODOs 10 | | Filename | line # | TODO 11 | |:------|:------:|:------ 12 | | lib/rules/camelcase.js | 1 | needs esformatter-plugin 13 | ### TODOs 14 | | Filename | line # | TODO 15 | |:------|:------:|:------ 16 | | lib/rules/comma-dangle.js | 1 | needs esformatter-plugin 17 | ### TODOs 18 | | Filename | line # | TODO 19 | |:------|:------:|:------ 20 | | lib/rules/comma-spacing.js | 14 | https://github.com/Flet/eslint-to-esformatter/issues/6 21 | | lib/rules/comma-spacing.js | 39 | this causes issues for a lot of variable statements 22 | ### TODOs 23 | | Filename | line # | TODO 24 | |:------|:------:|:------ 25 | | lib/rules/comma-style.js | 1 | needs esformatter-plugin 26 | ### TODOs 27 | | Filename | line # | TODO 28 | |:------|:------:|:------ 29 | | lib/rules/consistent-return.js | 1 | needs esformatter-plugin 30 | ### TODOs 31 | | Filename | line # | TODO 32 | |:------|:------:|:------ 33 | | lib/rules/consistent-this.js | 1 | needs esformatter-plugin 34 | ### TODOs 35 | | Filename | line # | TODO 36 | |:------|:------:|:------ 37 | | lib/rules/curly.js | 1 | needs esformatter-plugin 38 | ### TODOs 39 | | Filename | line # | TODO 40 | |:------|:------:|:------ 41 | | lib/rules/default-case.js | 1 | needs esformatter-plugin 42 | ### TODOs 43 | | Filename | line # | TODO 44 | |:------|:------:|:------ 45 | | lib/rules/dot-notation.js | 1 | needs esformatter-plugin 46 | ### TODOs 47 | | Filename | line # | TODO 48 | |:------|:------:|:------ 49 | | lib/rules/eqeqeq.js | 1 | needs esformatter-plugin 50 | ### TODOs 51 | | Filename | line # | TODO 52 | |:------|:------:|:------ 53 | | lib/rules/func-names.js | 1 | needs esformatter-plugin 54 | ### TODOs 55 | | Filename | line # | TODO 56 | |:------|:------:|:------ 57 | | lib/rules/func-style.js | 1 | needs esformatter-plugin 58 | ### TODOs 59 | | Filename | line # | TODO 60 | |:------|:------:|:------ 61 | | lib/rules/guard-for-in.js | 1 | needs esformatter-plugin 62 | ### TODOs 63 | | Filename | line # | TODO 64 | |:------|:------:|:------ 65 | | lib/rules/key-spacing.js | 8 | https://github.com/Flet/eslint-to-esformatter/issues/6 66 | | lib/rules/key-spacing.js | 22 | "align":"colon" and "align":"value" are not supported in eslint 67 | ### TODOs 68 | | Filename | line # | TODO 69 | |:------|:------:|:------ 70 | | lib/rules/max-len.js | 1 | needs esformatter-plugin 71 | ### TODOs 72 | | Filename | line # | TODO 73 | |:------|:------:|:------ 74 | | lib/rules/new-cap.js | 1 | needs esformatter-plugin 75 | ### TODOs 76 | | Filename | line # | TODO 77 | |:------|:------:|:------ 78 | | lib/rules/new-parens.js | 1 | needs esformatter-plugin 79 | ### TODOs 80 | | Filename | line # | TODO 81 | |:------|:------:|:------ 82 | | lib/rules/no-alert.js | 1 | needs esformatter-plugin 83 | ### TODOs 84 | | Filename | line # | TODO 85 | |:------|:------:|:------ 86 | | lib/rules/no-array-constructor.js | 1 | needs esformatter-plugin 87 | ### TODOs 88 | | Filename | line # | TODO 89 | |:------|:------:|:------ 90 | | lib/rules/no-console.js | 1 | needs esformatter-plugin 91 | ### TODOs 92 | | Filename | line # | TODO 93 | |:------|:------:|:------ 94 | | lib/rules/no-constant-condition.js | 1 | needs esformatter-plugin 95 | ### TODOs 96 | | Filename | line # | TODO 97 | |:------|:------:|:------ 98 | | lib/rules/no-debugger.js | 1 | needs esformatter-plugin 99 | ### TODOs 100 | | Filename | line # | TODO 101 | |:------|:------:|:------ 102 | | lib/rules/no-div-regex.js | 1 | needs esformatter-plugin 103 | ### TODOs 104 | | Filename | line # | TODO 105 | |:------|:------:|:------ 106 | | lib/rules/no-else-return.js | 1 | needs esformatter-plugin 107 | ### TODOs 108 | | Filename | line # | TODO 109 | |:------|:------:|:------ 110 | | lib/rules/no-eq-null.js | 1 | needs esformatter-plugin 111 | ### TODOs 112 | | Filename | line # | TODO 113 | |:------|:------:|:------ 114 | | lib/rules/no-extra-bind.js | 1 | needs esformatter-plugin 115 | ### TODOs 116 | | Filename | line # | TODO 117 | |:------|:------:|:------ 118 | | lib/rules/no-extra-boolean-cast.js | 1 | needs esformatter-plugin 119 | ### TODOs 120 | | Filename | line # | TODO 121 | |:------|:------:|:------ 122 | | lib/rules/no-extra-parens.js | 1 | needs esformatter-plugin 123 | ### TODOs 124 | | Filename | line # | TODO 125 | |:------|:------:|:------ 126 | | lib/rules/no-extra-semi.js | 1 | needs esformatter-plugin 127 | ### TODOs 128 | | Filename | line # | TODO 129 | |:------|:------:|:------ 130 | | lib/rules/no-fallthrough.js | 1 | needs esformatter-plugin 131 | ### TODOs 132 | | Filename | line # | TODO 133 | |:------|:------:|:------ 134 | | lib/rules/no-floating-decimal.js | 1 | needs esformatter-plugin 135 | ### TODOs 136 | | Filename | line # | TODO 137 | |:------|:------:|:------ 138 | | lib/rules/no-inline-comments.js | 1 | needs esformatter-plugin 139 | ### TODOs 140 | | Filename | line # | TODO 141 | |:------|:------:|:------ 142 | | lib/rules/no-inner-declarations.js | 1 | needs esformatter-plugin 143 | ### TODOs 144 | | Filename | line # | TODO 145 | |:------|:------:|:------ 146 | | lib/rules/no-irregular-whitespace.js | 1 | needs esformatter-plugin 147 | ### TODOs 148 | | Filename | line # | TODO 149 | |:------|:------:|:------ 150 | | lib/rules/no-lone-blocks.js | 1 | needs esformatter-plugin 151 | ### TODOs 152 | | Filename | line # | TODO 153 | |:------|:------:|:------ 154 | | lib/rules/no-lonely-if.js | 1 | needs esformatter-plugin 155 | ### TODOs 156 | | Filename | line # | TODO 157 | |:------|:------:|:------ 158 | | lib/rules/no-mixed-requires.js | 1 | needs esformatter-plugin 159 | ### TODOs 160 | | Filename | line # | TODO 161 | |:------|:------:|:------ 162 | | lib/rules/no-multi-str.js | 1 | needs esformatter-plugin 163 | ### TODOs 164 | | Filename | line # | TODO 165 | |:------|:------:|:------ 166 | | lib/rules/no-nested-ternary.js | 1 | needs esformatter-plugin 167 | ### TODOs 168 | | Filename | line # | TODO 169 | |:------|:------:|:------ 170 | | lib/rules/no-new-func.js | 1 | needs esformatter-plugin 171 | ### TODOs 172 | | Filename | line # | TODO 173 | |:------|:------:|:------ 174 | | lib/rules/no-new-object.js | 1 | needs esformatter-plugin 175 | ### TODOs 176 | | Filename | line # | TODO 177 | |:------|:------:|:------ 178 | | lib/rules/no-new-require.js | 1 | needs esformatter-plugin 179 | ### TODOs 180 | | Filename | line # | TODO 181 | |:------|:------:|:------ 182 | | lib/rules/no-new-wrappers.js | 1 | needs esformatter-plugin 183 | ### TODOs 184 | | Filename | line # | TODO 185 | |:------|:------:|:------ 186 | | lib/rules/no-path-concat.js | 1 | needs esformatter-plugin 187 | ### TODOs 188 | | Filename | line # | TODO 189 | |:------|:------:|:------ 190 | | lib/rules/no-plusplus.js | 1 | needs esformatter-plugin 191 | ### TODOs 192 | | Filename | line # | TODO 193 | |:------|:------:|:------ 194 | | lib/rules/no-regex-spaces.js | 1 | needs esformatter-plugin 195 | ### TODOs 196 | | Filename | line # | TODO 197 | |:------|:------:|:------ 198 | | lib/rules/no-self-compare.js | 1 | needs esformatter-plugin 199 | ### TODOs 200 | | Filename | line # | TODO 201 | |:------|:------:|:------ 202 | | lib/rules/no-ternary.js | 1 | needs esformatter-plugin 203 | ### TODOs 204 | | Filename | line # | TODO 205 | |:------|:------:|:------ 206 | | lib/rules/no-undef-init.js | 1 | needs esformatter-plugin 207 | ### TODOs 208 | | Filename | line # | TODO 209 | |:------|:------:|:------ 210 | | lib/rules/one-var.js | 1 | needs esformatter-plugin 211 | ### TODOs 212 | | Filename | line # | TODO 213 | |:------|:------:|:------ 214 | | lib/rules/operator-assignment.js | 1 | needs esformatter-plugin 215 | ### TODOs 216 | | Filename | line # | TODO 217 | |:------|:------:|:------ 218 | | lib/rules/quote-props.js | 1 | needs esformatter-plugin 219 | ### TODOs 220 | | Filename | line # | TODO 221 | |:------|:------:|:------ 222 | | lib/rules/quotes.js | 1 | needs esformatter-plugin 223 | ### TODOs 224 | | Filename | line # | TODO 225 | |:------|:------:|:------ 226 | | lib/rules/radix.js | 1 | needs esformatter-plugin 227 | ### TODOs 228 | | Filename | line # | TODO 229 | |:------|:------:|:------ 230 | | lib/rules/semi.js | 1 | needs esformatter-plugin 231 | ### TODOs 232 | | Filename | line # | TODO 233 | |:------|:------:|:------ 234 | | lib/rules/sort-vars.js | 1 | needs esformatter-plugin 235 | ### TODOs 236 | | Filename | line # | TODO 237 | |:------|:------:|:------ 238 | | lib/rules/use-isnan.js | 1 | needs esformatter-plugin 239 | ### TODOs 240 | | Filename | line # | TODO 241 | |:------|:------:|:------ 242 | | lib/rules/vars-on-top.js | 1 | needs esformatter-plugin 243 | ### TODOs 244 | | Filename | line # | TODO 245 | |:------|:------:|:------ 246 | | lib/rules/wrap-iife.js | 1 | needs esformatter-plugin 247 | ### TODOs 248 | | Filename | line # | TODO 249 | |:------|:------:|:------ 250 | | lib/rules/wrap-regex.js | 1 | needs esformatter-plugin 251 | ### TODOs 252 | | Filename | line # | TODO 253 | |:------|:------:|:------ 254 | | lib/rules/yoda.js | 1 | needs esformatter-plugin 255 | ### TODOs 256 | | Filename | line # | TODO 257 | |:------|:------:|:------ 258 | | test/brace-style.js | 67 | re-add test when https://github.com/millermedeiros/esformatter/issues/312 is fixed 259 | ### TODOs 260 | | Filename | line # | TODO 261 | |:------|:------:|:------ 262 | | test/comma-spacing.js | 78 | Is `bar = 2 ;` desired (assuming no)? Does it cause issues when linting? 263 | 264 | ‼ Scanned a total of 150 files. 65 contained todos/fixmes. 265 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | var util = require('util'); 2 | 3 | var _ = require('lodash'); 4 | var debug = require('debug'); 5 | 6 | var transformers = require('./lib/rules'); 7 | 8 | var log = debug('e2e:log'); 9 | var warn = debug('e2e:warn'); 10 | 11 | module.exports = function (cfg) { 12 | log('conversion started...'); 13 | 14 | var output = {}; 15 | var eslintRules = cfg.rules || {}; 16 | 17 | // TODO: may need to sort rules in a specific order 18 | Object.keys(transformers) 19 | .filter(function (rule) { 20 | var transformer = transformers[rule]; 21 | 22 | if (!transformer || transformer.supported === false) { 23 | warn('%s is not currently supported.', rule); 24 | return false; 25 | } 26 | 27 | if (transformer.informative) { 28 | log('%s is informative.', rule); 29 | return false; 30 | } 31 | 32 | if (transformer.deprecated) { 33 | warn('%s is deprecated', rule); 34 | return false; 35 | } 36 | 37 | return true; 38 | }) 39 | .forEach(function (rule) { 40 | log('\t%s started...', rule); 41 | 42 | var ruleValue = 0; 43 | if (eslintRules.hasOwnProperty(rule)) { ruleValue = eslintRules[rule]; } 44 | var ruleArgs = !Array.isArray(ruleValue) ? [ruleValue] : ruleValue; 45 | 46 | var transformer = transformers[rule]; 47 | 48 | output = _.merge(output, transformer.apply(null, ruleArgs)); 49 | 50 | log('\t%s finished!\n', rule); 51 | }); 52 | 53 | log('conversion finished!'); 54 | log('output:\n%s', util.inspect(output, { showHidden: false, depth: null })); 55 | 56 | return output; 57 | }; 58 | -------------------------------------------------------------------------------- /lib/rules/block-scoped-var.js: -------------------------------------------------------------------------------- 1 | module.exports = function (active, arg, options) { 2 | var output = {}; 3 | 4 | if (active < 1) return output; 5 | 6 | // todo: support through esformatter-plugin? 7 | }; 8 | 9 | module.exports.supported = false; 10 | -------------------------------------------------------------------------------- /lib/rules/brace-style.js: -------------------------------------------------------------------------------- 1 | var objectPath = require('object-path'); 2 | var warn = require('debug')('e2e:brace-style:warn'); 3 | 4 | var braceStyles = { 5 | '1tbs': function (output) { 6 | [ 7 | 'ArrowFunctionExpression', 8 | 'ClassDeclaration', 9 | 'Catch', 10 | 'DoWhileStatement', 11 | 'Finally', 12 | 'ForInStatement', 13 | 'ForStatement', 14 | 'FunctionExpression', 15 | 'FunctionDeclaration', 16 | 'IfStatement', 17 | 'ElseIfStatement', 18 | 'ElseStatement', 19 | 'Switch', 20 | 'Try', 21 | 'WhileStatement' 22 | ].forEach(function (type) { 23 | objectPath.set(output, ['lineBreak.before', type + 'OpeningBrace'], 0); 24 | objectPath.set(output, ['lineBreak.before', type + 'ClosingBrace'], '>=1'); 25 | }); 26 | }, 27 | 'stroustrup': function (output) { 28 | this['1tbs'](output); 29 | 30 | [ 31 | 'ElseIfStatement', 32 | 'ElseStatement', 33 | 'CatchKeyword' // todo: not working in esformatter 34 | ].forEach(function (type) { 35 | objectPath.set(output, ['lineBreak.before', type], 1); 36 | }); 37 | } 38 | }; 39 | 40 | module.exports = function (active, arg, options) { 41 | var output = {}; 42 | 43 | if (active < 1) return output; 44 | arg = arg ? arg : '1tbs'; 45 | 46 | objectPath.set(output, 'lineBreak.value', '\n'); 47 | 48 | (braceStyles[arg] || function () { 49 | warn('`%s` brace style not available.', arg); 50 | }).call(braceStyles, output); 51 | 52 | return output; 53 | }; 54 | -------------------------------------------------------------------------------- /lib/rules/camelcase.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /lib/rules/comma-dangle.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /lib/rules/comma-spacing.js: -------------------------------------------------------------------------------- 1 | var objectPath = require('object-path'); 2 | 3 | var nodeTypes = [ 4 | 'ArrayExpressionComma', 5 | 'ArgumentComma', 6 | 'CommaOperator', 7 | 'ParameterComma' 8 | ]; 9 | 10 | module.exports = function (active, options) { 11 | var output = {}; 12 | 13 | /* 14 | // todo: https://github.com/Flet/eslint-to-esformatter/issues/6 15 | nodeTypes 16 | .forEach(function (type) { 17 | objectPath.set(output, 'whiteSpace.before.' + type, -1); 18 | objectPath.set(output, 'whiteSpace.after.' + type, -1); 19 | }); 20 | 21 | objectPath.set(output, 'whiteSpace.after.PropertyValue', -1) 22 | */ 23 | 24 | if (active < 1) return output; 25 | options = options || { before: false, after: true }; 26 | if (!options.hasOwnProperty('before')) { options.before = false; } 27 | if (!options.hasOwnProperty('after')) { options.after = true; } 28 | 29 | // eslint doesn't seperate configuration by node 30 | // eslint only supports setting spacing to 1 space 31 | 32 | nodeTypes 33 | .forEach(function (type) { 34 | objectPath.set(output, 'whiteSpace.before.' + type, options.before ? 1 : 0); 35 | objectPath.set(output, 'whiteSpace.after.' + type, options.after ? 1 : 0); 36 | }); 37 | 38 | objectPath.set(output, 'whiteSpace.after.PropertyValue', options.before ? 1 : 0); 39 | // todo: this causes issues for a lot of variable statements 40 | // ex. `var d = 4 ;` Currently no option in esformatter 41 | objectPath.set(output, 'whiteSpace.after.VariableValue', options.before ? 1 : 0); 42 | 43 | return output; 44 | }; 45 | -------------------------------------------------------------------------------- /lib/rules/comma-style.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /lib/rules/complexity.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/consistent-return.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /lib/rules/consistent-this.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /lib/rules/curly.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /lib/rules/default-case.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /lib/rules/dot-notation.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /lib/rules/eol-last.js: -------------------------------------------------------------------------------- 1 | var objectPath = require('object-path'); 2 | 3 | module.exports = function (active) { 4 | var output = {}; 5 | 6 | if (active < 1) return output; 7 | 8 | objectPath.set(output, 'lineBreak.before.EndOfFile', 1); 9 | 10 | return output; 11 | }; 12 | -------------------------------------------------------------------------------- /lib/rules/eqeqeq.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /lib/rules/func-names.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /lib/rules/func-style.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /lib/rules/generator-star.js: -------------------------------------------------------------------------------- 1 | module.exports.deprecated = true; 2 | -------------------------------------------------------------------------------- /lib/rules/global-strict.js: -------------------------------------------------------------------------------- 1 | module.exports.deprecated = true; 2 | -------------------------------------------------------------------------------- /lib/rules/guard-for-in.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /lib/rules/handle-callback-err.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/indent.js: -------------------------------------------------------------------------------- 1 | var objectPath = require('object-path'); 2 | 3 | module.exports = function (active, arg, options) { 4 | var output = {}; 5 | 6 | if (active < 1) return output; 7 | arg = arg ? arg : 4; 8 | 9 | var indentValue; 10 | if (arg === 'tab') { 11 | indentValue = '\t'; 12 | } else { 13 | for (indentValue = ''; indentValue.length < arg;) { 14 | indentValue += ' '; 15 | } 16 | } 17 | 18 | objectPath.set(output, 'indent.value', indentValue); 19 | 20 | if (options && !options.indentSwitchCase) { 21 | objectPath.set(output, 'indent.SwitchCase', 0); 22 | } 23 | 24 | return output; 25 | }; 26 | -------------------------------------------------------------------------------- /lib/rules/index.js: -------------------------------------------------------------------------------- 1 | var requireDirectory = require('require-directory'); 2 | module.exports = requireDirectory(module); 3 | -------------------------------------------------------------------------------- /lib/rules/key-spacing.js: -------------------------------------------------------------------------------- 1 | var objectPath = require('object-path'); 2 | var warn = require('debug')('e2e:key-spacing:warn'); 3 | 4 | module.exports = function (active, options) { 5 | var output = {}; 6 | 7 | /* 8 | // todo: https://github.com/Flet/eslint-to-esformatter/issues/6 9 | objectPath.set(output, 'whiteSpace.after.PropertyName', -1); 10 | objectPath.set(output, 'whiteSpace.before.PropertyValue', -1); 11 | */ 12 | 13 | if (active < 1) return output; 14 | 15 | options = options || { beforeColon: false, afterColon: true }; 16 | if (!options.hasOwnProperty('beforeColon')) { options.beforeColon = false; } 17 | if (!options.hasOwnProperty('afterColon')) { options.afterColon = true; } 18 | 19 | objectPath.set(output, 'whiteSpace.after.PropertyName', options.beforeColon ? 1 : 0); 20 | objectPath.set(output, 'whiteSpace.before.PropertyValue', options.afterColon ? 1 : 0); 21 | 22 | // TODO "align":"colon" and "align":"value" are not supported in eslint 23 | if (options.align) { 24 | warn('`%s` option not supported.', options.align); 25 | } 26 | 27 | return output; 28 | }; 29 | -------------------------------------------------------------------------------- /lib/rules/max-depth.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/max-len.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /lib/rules/max-nested-callbacks.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/max-params.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/max-statements.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/new-cap.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /lib/rules/new-parens.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /lib/rules/newline-after-var.js: -------------------------------------------------------------------------------- 1 | var objectPath = require('object-path'); 2 | 3 | var ALWAYS = 'always'; 4 | var NEVER = 'never'; 5 | 6 | module.exports = function (active, arg) { 7 | var output = {}; 8 | 9 | if (active < 1) return output; 10 | arg = arg || ALWAYS; 11 | 12 | if (arg === ALWAYS) { 13 | objectPath.set(output, 'lineBreak.after.VariableDeclaration', 2); 14 | } else if (arg === NEVER) { 15 | objectPath.set(output, 'lineBreak.after.VariableDeclaration', 1); 16 | } 17 | 18 | return output; 19 | }; 20 | -------------------------------------------------------------------------------- /lib/rules/no-alert.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /lib/rules/no-array-constructor.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /lib/rules/no-bitwise.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/no-caller.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/no-catch-shadow.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/no-comma-dangle.js: -------------------------------------------------------------------------------- 1 | module.exports.deprecated = true; 2 | -------------------------------------------------------------------------------- /lib/rules/no-cond-assign.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/no-console.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /lib/rules/no-constant-condition.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /lib/rules/no-control-regex.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/no-debugger.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /lib/rules/no-delete-var.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/no-div-regex.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /lib/rules/no-dupe-args.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/no-dupe-keys.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/no-duplicate-case.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/no-else-return.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /lib/rules/no-empty-class.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/no-empty-label.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/no-empty.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/no-eq-null.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /lib/rules/no-eval.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/no-ex-assign.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/no-extend-native.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/no-extra-bind.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /lib/rules/no-extra-boolean-cast.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /lib/rules/no-extra-parens.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /lib/rules/no-extra-semi.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /lib/rules/no-extra-strict.js: -------------------------------------------------------------------------------- 1 | module.exports.deprecated = true; 2 | -------------------------------------------------------------------------------- /lib/rules/no-fallthrough.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /lib/rules/no-floating-decimal.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /lib/rules/no-func-assign.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/no-implied-eval.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/no-inline-comments.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /lib/rules/no-inner-declarations.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /lib/rules/no-invalid-regexp.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/no-irregular-whitespace.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /lib/rules/no-iterator.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/no-label-var.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/no-labels.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/no-lone-blocks.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /lib/rules/no-lonely-if.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /lib/rules/no-loop-func.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/no-mixed-requires.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /lib/rules/no-mixed-spaces-and-tabs.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/no-multi-str.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /lib/rules/no-native-reassign.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/no-negated-in-lhs.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/no-nested-ternary.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /lib/rules/no-new-func.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /lib/rules/no-new-object.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /lib/rules/no-new-require.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /lib/rules/no-new-wrappers.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /lib/rules/no-new.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/no-obj-calls.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/no-octal-escape.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/no-octal.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/no-param-reassign.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/no-path-concat.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /lib/rules/no-plusplus.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /lib/rules/no-process-env.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/no-process-exit.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/no-proto.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/no-redeclare.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/no-regex-spaces.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /lib/rules/no-reserved-keys.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/no-restricted-modules.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/no-return-assign.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/no-script-url.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/no-self-compare.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /lib/rules/no-sequences.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/no-shadow-restricted-names.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/no-shadow.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/no-space-before-semi.js: -------------------------------------------------------------------------------- 1 | module.exports.deprecated = true; 2 | -------------------------------------------------------------------------------- /lib/rules/no-sparse-arrays.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/no-sync.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/no-ternary.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /lib/rules/no-throw-literal.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/no-undef-init.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /lib/rules/no-undef.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/no-undefined.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/no-underscore-dangle.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/no-unreachable.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/no-unused-expressions.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/no-unused-vars.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/no-use-before-define.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/no-var.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/no-void.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/no-warning-comments.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/no-with.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/no-wrap-func.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/one-var.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /lib/rules/operator-assignment.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /lib/rules/quote-props.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /lib/rules/quotes.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /lib/rules/radix.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /lib/rules/semi.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /lib/rules/sort-vars.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /lib/rules/space-after-function-name.js: -------------------------------------------------------------------------------- 1 | module.exports.deprecated = true; 2 | -------------------------------------------------------------------------------- /lib/rules/space-before-function-parentheses.js: -------------------------------------------------------------------------------- 1 | module.exports.deprecated = true; 2 | -------------------------------------------------------------------------------- /lib/rules/space-unary-word-ops.js: -------------------------------------------------------------------------------- 1 | module.exports.deprecated = true; 2 | -------------------------------------------------------------------------------- /lib/rules/strict.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/use-isnan.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /lib/rules/valid-jsdoc.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/valid-typeof.js: -------------------------------------------------------------------------------- 1 | module.exports.informative = true; 2 | -------------------------------------------------------------------------------- /lib/rules/vars-on-top.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /lib/rules/wrap-iife.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /lib/rules/wrap-regex.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /lib/rules/yoda.js: -------------------------------------------------------------------------------- 1 | // todo: needs esformatter-plugin 2 | module.exports.supported = false; 3 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "eslint-to-esformatter", 3 | "description": "convert .eslintrc into esformatter json", 4 | "version": "1.0.0-alpha.1", 5 | "author": "Dan Flettre ", 6 | "bugs": { 7 | "url": "https://github.com/flet/eslint-to-esformatter/issues" 8 | }, 9 | "devDependencies": { 10 | "esformatter": "^0.6.1", 11 | "leasot": "^2.0.0", 12 | "multiline": "^1.0.2", 13 | "semistandard": "*", 14 | "tap-difflet": "^0.3.0", 15 | "tape": "^4.0.0" 16 | }, 17 | "homepage": "https://github.com/flet/eslint-to-esformatter", 18 | "license": "ISC", 19 | "keywords": [ 20 | "eslint", 21 | "esformatter", 22 | "convert", 23 | "format" 24 | ], 25 | "main": "index.js", 26 | "repository": { 27 | "type": "git", 28 | "url": "https://github.com/flet/eslint-to-esformatter.git" 29 | }, 30 | "scripts": { 31 | "test": "semistandard && tape test/*.js | tap-difflet", 32 | "todo": "leasot *.js lib/**/*.js test/**/*.js -r markdown > TODO.md || echo Refreshed TODO.md." 33 | }, 34 | "dependencies": { 35 | "debug": "^2.1.3", 36 | "lodash": "^3.6.0", 37 | "object-path": "^0.9.2", 38 | "require-directory": "^2.1.0" 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /test/block-scoped-var.js: -------------------------------------------------------------------------------- 1 | var testRule = require('./lib/test-rule'); 2 | 3 | testRule('(N/A) block-scoped-var', [], { skip: true }); 4 | -------------------------------------------------------------------------------- /test/brace-style.js: -------------------------------------------------------------------------------- 1 | var testRule = require('./lib/test-rule'); 2 | 3 | var multiline = require('multiline'); 4 | 5 | testRule('brace-style', [ 6 | { 7 | msg: 'rule off', 8 | rules: { 'brace-style': 0 }, 9 | input: multiline.stripIndent(function () {/* 10 | function foo() { 11 | return true; 12 | } 13 | */}) 14 | // formatted: input 15 | }, 16 | { 17 | msg: 'rule on, default 1tbs', 18 | rules: { 'brace-style': [2] }, 19 | input: multiline.stripIndent(function () {/* 20 | function foo() 21 | { 22 | return true; 23 | } 24 | 25 | if (foo) 26 | { 27 | bar(); 28 | } 29 | 30 | try 31 | { 32 | somethingRisky(); 33 | } catch (e) 34 | { 35 | handleError(); 36 | } 37 | 38 | if (foo) { 39 | bar(); 40 | } 41 | else { 42 | baz(); 43 | } 44 | */}), 45 | formatted: multiline.stripIndent(function () {/* 46 | function foo() { 47 | return true; 48 | } 49 | 50 | if (foo) { 51 | bar(); 52 | } 53 | 54 | try { 55 | somethingRisky(); 56 | } catch (e) { 57 | handleError(); 58 | } 59 | 60 | if (foo) { 61 | bar(); 62 | } else { 63 | baz(); 64 | } 65 | */}) 66 | } 67 | // todo: re-add test when https://github.com/millermedeiros/esformatter/issues/312 is fixed 68 | // { 69 | // msg: 'rule on, stroustrup', 70 | // rules: { 'brace-style': [2, 'stroustrup'] }, 71 | // input: multiline.stripIndent(function () {/* 72 | // function foo() 73 | // { 74 | // return true; 75 | // } 76 | // 77 | // if (foo) 78 | // { 79 | // bar(); 80 | // } 81 | // 82 | // try 83 | // { 84 | // somethingRisky(); 85 | // } catch (e) 86 | // { 87 | // handleError(); 88 | // } 89 | // 90 | // if (foo) { 91 | // bar(); 92 | // } 93 | // else { 94 | // baz(); 95 | // } 96 | // */}), 97 | // formatted: multiline.stripIndent(function () {/* 98 | // function foo() { 99 | // return true; 100 | // } 101 | // 102 | // if (foo) { 103 | // bar(); 104 | // } 105 | // 106 | // try { 107 | // somethingRisky(); 108 | // } 109 | // catch (e) { 110 | // handleError(); 111 | // } 112 | // 113 | // if (foo) { 114 | // bar(); 115 | // } 116 | // else { 117 | // baz(); 118 | // } 119 | // */}) 120 | // } 121 | ]); 122 | -------------------------------------------------------------------------------- /test/camelcase.js: -------------------------------------------------------------------------------- 1 | var testRule = require('./lib/test-rule'); 2 | 3 | testRule('(N/A) camel-case', [], { skip: true }); 4 | -------------------------------------------------------------------------------- /test/comma-spacing.js: -------------------------------------------------------------------------------- 1 | var testRule = require('./lib/test-rule'); 2 | 3 | var multiline = require('multiline'); 4 | 5 | testRule('comma-spacing', [ 6 | { 7 | msg: 'rule off', 8 | rules: { 'comma-spacing': 0 }, 9 | input: multiline.stripIndent(function () {/* 10 | var foo = 1 , 11 | bar = 2; 12 | var arr = [1 , 2]; 13 | var obj = { 14 | "foo": "bar" , 15 | "baz": "qur" 16 | }; 17 | foo(a ,b); 18 | new Foo(a ,b); 19 | function foo(a ,b) { 20 | } 21 | */}), 22 | formatted: multiline.stripIndent(function () {/* 23 | var foo = 1 , 24 | bar = 2; 25 | var arr = [1, 2]; 26 | var obj = { 27 | "foo": "bar", 28 | "baz": "qur" 29 | }; 30 | foo(a, b); 31 | new Foo(a, b); 32 | function foo(a, b) { 33 | } 34 | */}) 35 | }, 36 | { 37 | msg: 'rule on, default before false, after true', 38 | rules: { 'comma-spacing': [2, {}] }, 39 | input: multiline.stripIndent(function () {/* 40 | var foo = 1 ,bar = 2; 41 | var arr = [1 , 2]; 42 | var obj = {"foo": "bar" ,"baz": "qur"}; 43 | foo(a ,b); 44 | new Foo(a ,b); 45 | function foo(a ,b) { 46 | } 47 | */}), 48 | formatted: multiline.stripIndent(function () {/* 49 | var foo = 1, 50 | bar = 2; 51 | var arr = [1, 2]; 52 | var obj = { 53 | "foo": "bar", 54 | "baz": "qur" 55 | }; 56 | foo(a, b); 57 | new Foo(a, b); 58 | function foo(a, b) { 59 | } 60 | */}) 61 | }, 62 | { 63 | msg: 'rule on, before true, after unspecified', 64 | rules: { 'comma-spacing': [2, { before: true }]}, 65 | input: multiline.stripIndent(function () {/* 66 | var foo = 1, 67 | bar = 2; 68 | var arr = [1, 2]; 69 | var obj = { 70 | "foo": "bar", 71 | "baz": "qur" 72 | }; 73 | foo(a, b); 74 | new Foo(a, b); 75 | function foo(a, b) { 76 | } 77 | */}), 78 | // todo: Is `bar = 2 ;` desired (assuming no)? Does it cause issues when linting? 79 | // No option in esformatter to turn this off. 80 | // Related: `whiteSpace.after.VariableValue` 81 | formatted: multiline.stripIndent(function () {/* 82 | var foo = 1 , 83 | bar = 2 ; 84 | var arr = [1 , 2] ; 85 | var obj = { 86 | "foo": "bar" , 87 | "baz": "qur" 88 | } ; 89 | foo(a , b); 90 | new Foo(a , b); 91 | function foo(a , b) { 92 | } 93 | */}) 94 | } 95 | ]); 96 | -------------------------------------------------------------------------------- /test/eol-last.js: -------------------------------------------------------------------------------- 1 | var testRule = require('./lib/test-rule'); 2 | 3 | var multiline = require('multiline'); 4 | 5 | testRule('eol-last', [ 6 | { 7 | msg: 'rule off', 8 | rules: { 'eol-last': 0 }, 9 | input: multiline.stripIndent(function () {/* 10 | function doSmth() { 11 | 12 | } 13 | */}), 14 | formatted: multiline.stripIndent(function () {/* 15 | function doSmth() { 16 | 17 | } 18 | */}) 19 | }, 20 | { 21 | msg: 'rule on', 22 | rules: { 'eol-last': 2 }, 23 | input: multiline.stripIndent(function () {/* 24 | function doSmth() { 25 | 26 | } 27 | */}), 28 | formatted: multiline.stripIndent(function () {/* 29 | function doSmth() { 30 | 31 | } 32 | 33 | */}) 34 | } 35 | ]); 36 | -------------------------------------------------------------------------------- /test/indent.js: -------------------------------------------------------------------------------- 1 | var testRule = require('./lib/test-rule'); 2 | 3 | var multiline = require('multiline'); 4 | 5 | testRule('indent', [ 6 | { 7 | msg: 'rule on, 2 spaces', 8 | rules: { 'indent': [2, 2] }, 9 | input: multiline.stripIndent(function () {/* 10 | if (a) { 11 | b=c; 12 | function fn(d) { 13 | e=f; 14 | } 15 | } 16 | */}), 17 | formatted: multiline.stripIndent(function () {/* 18 | if (a) { 19 | b = c; 20 | function fn(d) { 21 | e = f; 22 | } 23 | } 24 | */}) 25 | }, 26 | { 27 | msg: 'rule on, default 4 spaces', 28 | rules: { 'indent': [2] }, 29 | input: multiline.stripIndent(function () {/* 30 | if (a) { 31 | b=c; 32 | function fn(d) { 33 | e=f; 34 | } 35 | } 36 | */}), 37 | formatted: multiline.stripIndent(function () {/* 38 | if (a) { 39 | b = c; 40 | function fn(d) { 41 | e = f; 42 | } 43 | } 44 | */}) 45 | }, 46 | { 47 | msg: 'rule on, 10 spaces', 48 | rules: {'indent': [2, 10]}, 49 | input: multiline.stripIndent(function () {/* 50 | if (a) { 51 | b=c; 52 | function fn(d) { 53 | e=f; 54 | } 55 | } 56 | */}), 57 | formatted: multiline.stripIndent(function () {/* 58 | if (a) { 59 | b = c; 60 | function fn(d) { 61 | e = f; 62 | } 63 | } 64 | */}) 65 | }, 66 | { 67 | msg: 'rule on, tab', 68 | rules: { 'indent': [2, 'tab'] }, 69 | input: multiline.stripIndent(function () {/* 70 | if (a) { 71 | b=c; 72 | function fn(d) { 73 | e=f; 74 | } 75 | } 76 | */}), 77 | formatted: '' + 78 | 'if (a) {\n' + 79 | '\tb = c;\n' + 80 | '\tfunction fn(d) {\n' + 81 | '\t\te = f;\n' + 82 | '\t}\n' + 83 | '}' 84 | }, 85 | { 86 | msg: 'rule on, 2 spaces, indentSwitchCase false', 87 | rules: { 'indent': [2, 2, { indentSwitchCase: false }] }, 88 | input: multiline.stripIndent(function () {/* 89 | switch ('blah') { 90 | case 'foo': 91 | console.log('hello'); 92 | default: 93 | console.log('nope'); 94 | } 95 | */}), 96 | formatted: multiline.stripIndent(function () {/* 97 | switch ('blah') { 98 | case 'foo': 99 | console.log('hello'); 100 | default: 101 | console.log('nope'); 102 | } 103 | */}) 104 | } 105 | ]); 106 | -------------------------------------------------------------------------------- /test/key-spacing.js: -------------------------------------------------------------------------------- 1 | var testRule = require('./lib/test-rule'); 2 | 3 | var multiline = require('multiline'); 4 | 5 | testRule('key-spacing', [ 6 | { 7 | msg: 'rule off', 8 | rules: { 'key-spacing': 0 }, 9 | input: multiline.stripIndent(function () {/* 10 | var obj = { 11 | foo : 42 12 | }; 13 | */}), 14 | formatted: multiline.stripIndent(function () {/* 15 | var obj = { 16 | foo: 42 17 | }; 18 | */}) 19 | }, 20 | { 21 | msg: 'rule on, default beforeColon false, afterColon true', 22 | rules: { 'key-spacing': [2] }, 23 | input: multiline.stripIndent(function () {/* 24 | var obj = { foo : 42 }; 25 | */}), 26 | formatted: multiline.stripIndent(function () {/* 27 | var obj = { 28 | foo: 42 29 | }; 30 | */}) 31 | }, 32 | { 33 | msg: 'rule on, beforeColon true, afterColon false', 34 | rules: { 'key-spacing': [2, { beforeColon: true, afterColon: false }] }, 35 | input: multiline.stripIndent(function () {/* 36 | var obj = { foo: 42 }; 37 | */}), 38 | formatted: multiline.stripIndent(function () {/* 39 | var obj = { 40 | foo :42 41 | }; 42 | */}) 43 | }, 44 | { 45 | msg: 'rule on, beforeColon true, afteColon unspecified', 46 | rules: { 'key-spacing': [2, { beforeColon: true }] }, 47 | input: multiline.stripIndent(function () {/* 48 | var obj = { foo: 42 }; 49 | */}), 50 | formatted: multiline.stripIndent(function () {/* 51 | var obj = { 52 | foo : 42 53 | }; 54 | */}) 55 | }, 56 | { 57 | msg: 'rule on, beforeColon false, afteColon unspecified', 58 | rules: { 'key-spacing': [2, { beforeColon: false }] }, 59 | input: multiline.stripIndent(function () {/* 60 | var obj = { foo : 42 }; 61 | */}), 62 | formatted: multiline.stripIndent(function () {/* 63 | var obj = { 64 | foo: 42 65 | }; 66 | */}) 67 | }, 68 | { 69 | msg: 'rule on, afterColon true, beforeColon unspecified', 70 | rules: { 'key-spacing': [2, { afterColon: true }]}, 71 | input: multiline.stripIndent(function () {/* 72 | var obj = { foo : 42 }; 73 | */}), 74 | formatted: multiline.stripIndent(function () {/* 75 | var obj = { 76 | foo: 42 77 | }; 78 | */}) 79 | } 80 | ]); 81 | -------------------------------------------------------------------------------- /test/lib/test-rule.js: -------------------------------------------------------------------------------- 1 | var convert = require('./../../'); 2 | var esformatter = require('esformatter'); 3 | 4 | var test = require('tape'); 5 | 6 | module.exports = function (name, transforms, options) { 7 | if (options && options.skip) return; 8 | test(name, function (t) { 9 | t.plan(transforms.length); 10 | 11 | transforms.forEach(function (transform) { 12 | var opts = convert({ 13 | rules: transform.rules 14 | }); 15 | 16 | t.equal(esformatter.format(transform.input, opts), transform.formatted || transform.input, 'format using: ' + transform.msg); 17 | }); 18 | }); 19 | }; 20 | -------------------------------------------------------------------------------- /test/newline-after-var.js: -------------------------------------------------------------------------------- 1 | var testRule = require('./lib/test-rule'); 2 | 3 | var multiline = require('multiline'); 4 | 5 | testRule('newline-after-var', [ 6 | { 7 | msg: 'rule off', 8 | rules: { 'newline-after-var': 0 }, 9 | input: multiline.stripIndent(function () {/* 10 | var greet = "hello,", 11 | name = "world"; 12 | console.log(greet, name); 13 | */}), 14 | formatted: multiline.stripIndent(function () {/* 15 | var greet = "hello,", 16 | name = "world"; 17 | console.log(greet, name); 18 | */}) 19 | }, 20 | { 21 | msg: 'rule on, default "always"', 22 | rules: { 'newline-after-var': [2] }, 23 | input: multiline.stripIndent(function () {/* 24 | var greet = "hello,", 25 | name = "world"; 26 | console.log(greet, name); 27 | */}), 28 | formatted: multiline.stripIndent(function () {/* 29 | var greet = "hello,", 30 | name = "world"; 31 | 32 | console.log(greet, name); 33 | */}) 34 | }, 35 | { 36 | msg: 'rule on, "never"', 37 | rules: { 'newline-after-var': [2, 'never'] }, 38 | input: multiline.stripIndent(function () {/* 39 | var greet = "hello,", 40 | name = "world"; 41 | 42 | console.log(greet, name); 43 | */}), 44 | formatted: multiline.stripIndent(function () {/* 45 | var greet = "hello,", 46 | name = "world"; 47 | console.log(greet, name); 48 | */}) 49 | } 50 | ]); 51 | --------------------------------------------------------------------------------