Infer options from eslint-plugin-prettier
See original GitHub issueWhen using prettier-eslint with my .eslintrc I get an error. Any thoughts on what it may be? I used the trace loglevel and got the output below. This is not all the output, but the inferred options and the file that was being linted. I am also using eslint-plugin-prettier. I have a rule for it in .eslintrc:
"prettier/prettier": [
"error",
{
"trailingComma": "all",
"singleQuote": true,
"printWidth": 120
}
]
prettier-eslint --write filename --logLevel trace
prettier-eslint [DEBUG]: inferred options: Object {
"eslintConfig": Object {
"ecmaFeatures": Object {
"jsx": true,
},
"env": Object {
"browser": true,
"es6": true,
"node": true,
},
"extends": Array [
"airbnb",
"plugin:flowtype/recommended",
"/Users/awesome/Sites/maggie/node_modules/eslint-config-airbnb/rules/react.js",
"/Users/awesome/Sites/maggie/node_modules/eslint-config-airbnb/rules/react-a11y.js",
"/Users/awesome/Sites/maggie/node_modules/eslint-config-airbnb-base/rules/variables.js",
"/Users/awesome/Sites/maggie/node_modules/eslint-config-airbnb-base/rules/es6.js",
"/Users/awesome/Sites/maggie/node_modules/eslint-config-airbnb-base/rules/imports.js",
],
"fix": true,
"globals": Array [],
"parser": "/Users/awesome/Sites/maggie/node_modules/babel-eslint/index.js",
"parserOptions": Object {
"ecmaFeatures": Object {
"experimentalObjectRestSpread": true,
"generators": false,
"globalReturn": true,
"jsx": true,
"objectLiteralDuplicateProperties": false,
},
"ecmaVersion": 6,
"sourceType": "module",
},
"plugins": Array [
"import",
"react",
"jsx-a11y",
"prettier",
"flowtype",
],
"rules": Object {
"accessor-pairs": "off",
"array-bracket-spacing": Array [
"error",
"never",
],
"array-callback-return": "error",
"arrow-body-style": Array [
2,
"as-needed",
],
"arrow-parens": Array [
"error",
"as-needed",
],
"arrow-spacing": Array [
"error",
Object {
"after": true,
"before": true,
},
],
"block-scoped-var": "error",
"block-spacing": Array [
"error",
"always",
],
"brace-style": Array [
"error",
"1tbs",
Object {
"allowSingleLine": true,
},
],
"callback-return": "off",
"camelcase": Array [
"error",
Object {
"properties": "never",
},
],
"class-methods-use-this": Array [
0,
Object {
"exceptMethods": Array [
"render",
"getInitialState",
"getDefaultProps",
"getChildContext",
"componentWillMount",
"componentDidMount",
"componentWillReceiveProps",
"shouldComponentUpdate",
"componentWillUpdate",
"componentDidUpdate",
"componentWillUnmount",
],
},
],
"comma-dangle": Array [
2,
"always-multiline",
],
"comma-spacing": Array [
"error",
Object {
"after": true,
"before": false,
},
],
"comma-style": Array [
"error",
"last",
],
"complexity": Array [
"off",
11,
],
"computed-property-spacing": Array [
"error",
"never",
],
"consistent-return": "error",
"consistent-this": "off",
"constructor-super": "error",
"curly": Array [
"error",
"multi-line",
],
"default-case": Array [
"error",
Object {
"commentPattern": "^no default$",
},
],
"dot-location": Array [
"error",
"property",
],
"dot-notation": Array [
"error",
Object {
"allowKeywords": true,
},
],
"eol-last": Array [
"error",
"always",
],
"eqeqeq": Array [
"error",
"allow-null",
],
"flowtype/boolean-style": Array [
2,
"boolean",
],
"flowtype/define-flow-type": 1,
"flowtype/delimiter-dangle": 0,
"flowtype/generic-spacing": Array [
2,
"never",
],
"flowtype/no-weak-types": 0,
"flowtype/object-type-delimiter": Array [
2,
"comma",
],
"flowtype/require-parameter-type": 0,
"flowtype/require-return-type": 0,
"flowtype/require-valid-file-annotation": 0,
"flowtype/semi": 0,
"flowtype/space-after-type-colon": Array [
2,
"always",
],
"flowtype/space-before-generic-bracket": Array [
2,
"never",
],
"flowtype/space-before-type-colon": Array [
2,
"never",
],
"flowtype/type-id-match": 0,
"flowtype/union-intersection-spacing": Array [
2,
"always",
],
"flowtype/use-flow-type": 1,
"flowtype/valid-syntax": 1,
"func-call-spacing": Array [
"error",
"never",
],
"func-name-matching": Array [
"off",
"always",
Object {
"includeCommonJSModuleExports": false,
},
],
"func-names": "warn",
"func-style": Array [
"off",
"expression",
],
"generator-star-spacing": Array [
"error",
Object {
"after": true,
"before": false,
},
],
"guard-for-in": "error",
"handle-callback-err": "off",
"id-blacklist": "off",
"id-length": "off",
"id-match": "off",
"import/default": "off",
"import/export": "error",
"import/extensions": Array [
0,
"always",
Object {
"js": "never",
"jsx": "never",
},
],
"import/first": Array [
"error",
"absolute-first",
],
"import/imports-first": 0,
"import/max-dependencies": Array [
"off",
Object {
"max": 10,
},
],
"import/named": "off",
"import/namespace": "off",
"import/newline-after-import": 0,
"import/no-absolute-path": "error",
"import/no-amd": "error",
"import/no-commonjs": "off",
"import/no-deprecated": "off",
"import/no-duplicates": "error",
"import/no-dynamic-require": 0,
"import/no-extraneous-dependencies": Array [
0,
Object {
"devDependencies": Array [
"spec/**",
"test/**",
"tests/**",
"**/__tests__/**",
],
"optionalDependencies": false,
},
],
"import/no-internal-modules": Array [
"off",
Object {
"allow": Array [],
},
],
"import/no-mutable-exports": "error",
"import/no-named-as-default": 0,
"import/no-named-as-default-member": "error",
"import/no-named-default": "error",
"import/no-namespace": "off",
"import/no-nodejs-modules": "off",
"import/no-restricted-paths": "off",
"import/no-unassigned-import": "off",
"import/no-unresolved": Array [
0,
Object {
"caseSensitive": true,
"commonjs": true,
},
],
"import/no-webpack-loader-syntax": "error",
"import/order": Array [
"off",
Object {
"groups": Array [
"builtin",
"external",
"internal",
"parent",
"sibling",
"index",
],
"newlines-between": "never",
},
],
"import/prefer-default-export": 0,
"import/unambiguous": "off",
"indent": Array [
0,
"tab",
Object {
"SwitchCase": 1,
},
],
"init-declarations": "off",
"jsx-a11y/anchor-has-content": Array [
"error",
Array [
"",
],
],
"jsx-a11y/aria-props": 2,
"jsx-a11y/aria-proptypes": "error",
"jsx-a11y/aria-role": "error",
"jsx-a11y/aria-unsupported-elements": "error",
"jsx-a11y/click-events-have-key-events": "off",
"jsx-a11y/heading-has-content": Array [
0,
Array [
"",
],
],
"jsx-a11y/href-no-hash": Array [
2,
Array [
"a",
],
],
"jsx-a11y/html-has-lang": "error",
"jsx-a11y/img-has-alt": "error",
"jsx-a11y/img-redundant-alt": "error",
"jsx-a11y/label-has-for": Array [
2,
Array [
"label",
],
],
"jsx-a11y/lang": "error",
"jsx-a11y/mouse-events-have-key-events": 2,
"jsx-a11y/no-access-key": "error",
"jsx-a11y/no-marquee": "error",
"jsx-a11y/no-onchange": "off",
"jsx-a11y/no-static-element-interactions": "error",
"jsx-a11y/onclick-has-focus": "off",
"jsx-a11y/onclick-has-role": "off",
"jsx-a11y/role-has-required-aria-props": 2,
"jsx-a11y/role-supports-aria-props": 2,
"jsx-a11y/scope": "error",
"jsx-a11y/tabindex-no-positive": "error",
"jsx-quotes": Array [
"error",
"prefer-double",
],
"key-spacing": Array [
"error",
Object {
"afterColon": true,
"beforeColon": false,
},
],
"keyword-spacing": Array [
"error",
Object {
"after": true,
"before": true,
"overrides": Object {
"case": Object {
"after": true,
},
"return": Object {
"after": true,
},
"throw": Object {
"after": true,
},
},
},
],
"line-comment-position": Array [
"off",
Object {
"applyDefaultPatterns": true,
"ignorePattern": "",
"position": "above",
},
],
"linebreak-style": Array [
"error",
"unix",
],
"lines-around-comment": "off",
"lines-around-directive": Array [
"error",
Object {
"after": "always",
"before": "always",
},
],
"max-depth": Array [
"off",
4,
],
"max-len": Array [
0,
100,
2,
Object {
"ignoreComments": false,
"ignoreRegExpLiterals": true,
"ignoreStrings": true,
"ignoreTemplateLiterals": true,
"ignoreUrls": true,
},
],
"max-lines": Array [
"off",
Object {
"max": 300,
"skipBlankLines": true,
"skipComments": true,
},
],
"max-nested-callbacks": "off",
"max-params": Array [
"off",
3,
],
"max-statements": Array [
"off",
10,
],
"max-statements-per-line": Array [
"off",
Object {
"max": 1,
},
],
"multiline-ternary": Array [
"off",
"never",
],
"new-cap": Array [
"error",
Object {
"capIsNew": false,
"capIsNewExceptions": Array [
"Immutable.Map",
"Immutable.Set",
"Immutable.List",
],
"newIsCap": true,
"newIsCapExceptions": Array [],
},
],
"new-parens": "error",
"newline-after-var": "off",
"newline-before-return": "off",
"newline-per-chained-call": Array [
0,
Object {
"ignoreChainWithDepth": 4,
},
],
"no-alert": "warn",
"no-array-constructor": "error",
"no-bitwise": "error",
"no-caller": "error",
"no-case-declarations": "error",
"no-catch-shadow": "off",
"no-class-assign": "error",
"no-cond-assign": Array [
"error",
"always",
],
"no-confusing-arrow": Array [
"error",
Object {
"allowParens": true,
},
],
"no-console": Array [
1,
Object {
"allow": Array [
"warn",
"error",
"debug",
],
},
],
"no-const-assign": "error",
"no-constant-condition": "warn",
"no-continue": "error",
"no-control-regex": "error",
"no-debugger": "error",
"no-delete-var": "error",
"no-div-regex": "off",
"no-dupe-args": "error",
"no-dupe-class-members": "error",
"no-dupe-keys": "error",
"no-duplicate-case": "error",
"no-duplicate-imports": 0,
"no-else-return": "error",
"no-empty": "error",
"no-empty-character-class": "error",
"no-empty-function": Array [
"error",
Object {
"allow": Array [
"arrowFunctions",
"functions",
"methods",
],
},
],
"no-empty-pattern": "error",
"no-eq-null": "off",
"no-eval": "error",
"no-ex-assign": "error",
"no-extend-native": "error",
"no-extra-bind": "error",
"no-extra-boolean-cast": "error",
"no-extra-label": "error",
"no-extra-parens": Array [
"off",
"all",
Object {
"conditionalAssign": true,
"nestedBinaryExpressions": false,
"returnAssign": false,
},
],
"no-extra-semi": "error",
"no-fallthrough": "error",
"no-floating-decimal": "error",
"no-func-assign": "error",
"no-global-assign": Array [
"error",
Object {
"exceptions": Array [],
},
],
"no-implicit-coercion": Array [
"off",
Object {
"allow": Array [],
"boolean": false,
"number": true,
"string": true,
},
],
"no-implicit-globals": "off",
"no-implied-eval": "error",
"no-inline-comments": "off",
"no-inner-declarations": "error",
"no-invalid-regexp": "error",
"no-invalid-this": "off",
"no-irregular-whitespace": "error",
"no-iterator": "error",
"no-label-var": "error",
"no-labels": Array [
"error",
Object {
"allowLoop": false,
"allowSwitch": false,
},
],
"no-lone-blocks": "error",
"no-lonely-if": "error",
"no-loop-func": "error",
"no-magic-numbers": Array [
"off",
Object {
"detectObjects": false,
"enforceConst": true,
"ignore": Array [],
"ignoreArrayIndexes": true,
},
],
"no-mixed-operators": Array [
"error",
Object {
"allowSamePrecedence": false,
"groups": Array [
Array [
"+",
"-",
"*",
"/",
"%",
"**",
],
Array [
"&",
"|",
"^",
"~",
"<<",
">>",
">>>",
],
Array [
"==",
"!=",
"===",
"!==",
">",
">=",
"<",
"<=",
],
Array [
"&&",
"||",
],
Array [
"in",
"instanceof",
],
],
},
],
"no-mixed-requires": Array [
"off",
false,
],
"no-mixed-spaces-and-tabs": "error",
"no-multi-spaces": "error",
"no-multi-str": "error",
"no-multiple-empty-lines": Array [
"error",
Object {
"max": 2,
"maxEOF": 1,
},
],
"no-native-reassign": "off",
"no-negated-condition": "off",
"no-negated-in-lhs": "off",
"no-nested-ternary": "error",
"no-new": "error",
"no-new-func": "error",
"no-new-object": "error",
"no-new-require": "error",
"no-new-symbol": "error",
"no-new-wrappers": "error",
"no-obj-calls": "error",
"no-octal": "error",
"no-octal-escape": "error",
"no-param-reassign": Array [
"error",
Object {
"props": true,
},
],
"no-path-concat": "error",
"no-plusplus": "error",
"no-process-env": "off",
"no-process-exit": "off",
"no-proto": "error",
"no-prototype-builtins": "error",
"no-redeclare": "error",
"no-regex-spaces": "error",
"no-restricted-globals": "off",
"no-restricted-imports": "off",
"no-restricted-modules": "off",
"no-restricted-properties": Array [
"error",
Object {
"message": "arguments.callee is deprecated",
"object": "arguments",
"property": "callee",
},
Object {
"message": "Please use Object.defineProperty instead.",
"property": "__defineGetter__",
},
Object {
"message": "Please use Object.defineProperty instead.",
"property": "__defineSetter__",
},
Object {
"message": "Use the exponentiation operator (**) instead.",
"object": "Math",
"property": "pow",
},
],
"no-restricted-syntax": Array [
"error",
"ForInStatement",
"ForOfStatement",
"LabeledStatement",
"WithStatement",
],
"no-return-assign": "error",
"no-script-url": "error",
"no-self-assign": "error",
"no-self-compare": "error",
"no-sequences": "error",
"no-shadow": "error",
"no-shadow-restricted-names": "error",
"no-spaced-func": "error",
"no-sparse-arrays": "error",
"no-sync": "off",
"no-tabs": 0,
"no-template-curly-in-string": "error",
"no-ternary": "off",
"no-this-before-super": "error",
"no-throw-literal": "error",
"no-trailing-spaces": "error",
"no-undef": "error",
"no-undef-init": "error",
"no-undefined": "off",
"no-underscore-dangle": Array [
"off",
Object {
"allowAfterThis": false,
},
],
"no-unexpected-multiline": "error",
"no-unmodified-loop-condition": "off",
"no-unneeded-ternary": Array [
"error",
Object {
"defaultAssignment": false,
},
],
"no-unreachable": "error",
"no-unsafe-finally": "error",
"no-unsafe-negation": "error",
"no-unused-expressions": Array [
"error",
Object {
"allowShortCircuit": false,
"allowTernary": false,
},
],
"no-unused-labels": "error",
"no-unused-vars": Array [
"error",
Object {
"args": "after-used",
"vars": "local",
},
],
"no-use-before-define": 0,
"no-useless-call": "off",
"no-useless-computed-key": "error",
"no-useless-concat": "error",
"no-useless-constructor": "error",
"no-useless-escape": "error",
"no-useless-rename": Array [
"error",
Object {
"ignoreDestructuring": false,
"ignoreExport": false,
"ignoreImport": false,
},
],
"no-useless-return": "error",
"no-void": "error",
"no-warning-comments": Array [
"off",
Object {
"location": "start",
"terms": Array [
"todo",
"fixme",
"xxx",
],
},
],
"no-whitespace-before-property": "error",
"object-curly-newline": Array [
"off",
Object {
"ObjectExpression": Object {
"minProperties": 0,
"multiline": true,
},
"ObjectPattern": Object {
"minProperties": 0,
"multiline": true,
},
},
],
"object-curly-spacing": Array [
"error",
"always",
],
"object-property-newline": Array [
"error",
Object {
"allowMultiplePropertiesPerLine": true,
},
],
"object-shorthand": Array [
"error",
"always",
Object {
"avoidQuotes": true,
"ignoreConstructors": false,
},
],
"one-var": Array [
"error",
"never",
],
"one-var-declaration-per-line": Array [
"error",
"always",
],
"operator-assignment": Array [
"error",
"always",
],
"operator-linebreak": "off",
"padded-blocks": Array [
"error",
"never",
],
"prefer-arrow-callback": Array [
"error",
Object {
"allowNamedFunctions": false,
"allowUnboundThis": true,
},
],
"prefer-numeric-literals": "error",
"prefer-reflect": "off",
"prefer-rest-params": "error",
"prefer-spread": "error",
"prefer-template": 2,
"prettier/prettier": Array [
"error",
Object {
"printWidth": 120,
"singleQuote": true,
"trailingComma": "all",
},
],
"quote-props": Array [
"error",
"as-needed",
Object {
"keywords": false,
"numbers": false,
"unnecessary": true,
},
],
"quotes": Array [
"error",
"single",
Object {
"avoidEscape": true,
},
],
"radix": "error",
"react/display-name": Array [
"off",
Object {
"ignoreTranspilerName": false,
},
],
"react/forbid-component-props": Array [
"off",
Object {
"forbid": Array [],
},
],
"react/forbid-prop-types": Array [
0,
Object {
"forbid": Array [
"any",
"array",
"object",
],
},
],
"react/jsx-boolean-value": Array [
"error",
"never",
],
"react/jsx-closing-bracket-location": Array [
"error",
"line-aligned",
],
"react/jsx-curly-spacing": Array [
"error",
"never",
Object {
"allowMultiline": true,
},
],
"react/jsx-equals-spacing": Array [
"error",
"never",
],
"react/jsx-filename-extension": Array [
0,
Object {
"extensions": Array [
".jsx",
],
},
],
"react/jsx-first-prop-new-line": Array [
2,
"multiline",
],
"react/jsx-handler-names": Array [
"off",
Object {
"eventHandlerPrefix": "handle",
"eventHandlerPropPrefix": "on",
},
],
"react/jsx-indent": Array [
0,
"tab",
],
"react/jsx-indent-props": Array [
0,
"tab",
],
"react/jsx-key": "off",
"react/jsx-max-props-per-line": Array [
"off",
Object {
"maximum": 1,
},
],
"react/jsx-no-bind": Array [
"error",
Object {
"allowArrowFunctions": true,
"allowBind": false,
"ignoreRefs": true,
},
],
"react/jsx-no-comment-textnodes": "error",
"react/jsx-no-duplicate-props": Array [
"error",
Object {
"ignoreCase": true,
},
],
"react/jsx-no-literals": "off",
"react/jsx-no-target-blank": 0,
"react/jsx-no-undef": "error",
"react/jsx-pascal-case": Array [
"error",
Object {
"allowAllCaps": true,
"ignore": Array [],
},
],
"react/jsx-sort-prop-types": "off",
"react/jsx-sort-props": Array [
"off",
Object {
"callbacksLast": false,
"ignoreCase": true,
"shorthandFirst": false,
"shorthandLast": false,
},
],
"react/jsx-space-before-closing": Array [
"error",
"always",
],
"react/jsx-uses-react": Array [
"error",
],
"react/jsx-uses-vars": "error",
"react/jsx-wrap-multilines": Array [
"error",
Object {
"assignment": true,
"declaration": true,
"return": true,
},
],
"react/no-children-prop": "error",
"react/no-comment-textnodes": "off",
"react/no-danger": "warn",
"react/no-danger-with-children": "error",
"react/no-deprecated": Array [
"error",
],
"react/no-did-mount-set-state": Array [
"error",
],
"react/no-did-update-set-state": Array [
"error",
],
"react/no-direct-mutation-state": "off",
"react/no-find-dom-node": "error",
"react/no-is-mounted": "error",
"react/no-multi-comp": Array [
"error",
Object {
"ignoreStateless": true,
},
],
"react/no-render-return-value": "error",
"react/no-set-state": "off",
"react/no-string-refs": "error",
"react/no-unescaped-entities": "error",
"react/no-unknown-property": "error",
"react/no-unused-prop-types": Array [
"error",
Object {
"customValidators": Array [],
"skipShapeProps": true,
},
],
"react/prefer-es6-class": Array [
"error",
"always",
],
"react/prefer-stateless-function": "error",
"react/prop-types": Array [
"error",
Object {
"customValidators": Array [],
"ignore": Array [],
},
],
"react/react-in-jsx-scope": "error",
"react/require-extension": Array [
0,
Object {
"extensions": Array [
".jsx",
".js",
],
},
],
"react/require-optimization": Array [
"off",
Object {
"allowDecorators": Array [],
},
],
"react/require-render-return": "error",
"react/self-closing-comp": 0,
"react/sort-comp": Array [
2,
Object {
"order": Array [
"type-annotations",
"static-methods",
"lifecycle",
"everything-else",
"render",
],
},
],
"react/sort-prop-types": Array [
"off",
Object {
"callbacksLast": false,
"ignoreCase": true,
"requiredFirst": false,
},
],
"react/style-prop-object": "error",
"react/wrap-multilines": "off",
"require-jsdoc": "off",
"require-yield": "error",
"rest-spread-spacing": Array [
"error",
"never",
],
"semi": Array [
"error",
"always",
],
"semi-spacing": Array [
"error",
Object {
"after": true,
"before": false,
},
],
"sort-imports": Array [
"off",
Object {
"ignoreCase": false,
"ignoreMemberSort": false,
"memberSyntaxSortOrder": Array [
"none",
"all",
"multiple",
"single",
],
},
],
"sort-keys": Array [
"off",
"asc",
Object {
"caseSensitive": false,
"natural": true,
},
],
"sort-vars": "off",
"space-before-blocks": "error",
"space-before-function-paren": Array [
"error",
Object {
"anonymous": "always",
"asyncArrow": "always",
"named": "never",
},
],
"space-in-parens": Array [
"error",
"never",
],
"space-infix-ops": "error",
"space-unary-ops": Array [
"error",
Object {
"nonwords": false,
"overrides": Object {},
"words": true,
},
],
"spaced-comment": Array [
"error",
"always",
Object {
"block": Object {
"balanced": false,
"exceptions": Array [
"-",
"+",
],
"markers": Array [
"=",
"!",
],
},
"line": Object {
"exceptions": Array [
"-",
"+",
],
"markers": Array [
"=",
"!",
],
},
},
],
"strict": Array [
"error",
"never",
],
"symbol-description": "error",
"template-curly-spacing": "error",
"unicode-bom": Array [
"error",
"never",
],
"use-isnan": "error",
"valid-typeof": Array [
"error",
Object {
"requireStringLiterals": true,
},
],
"vars-on-top": "error",
"wrap-iife": Array [
"error",
"outside",
Object {
"functionPrototypeMethods": false,
},
],
"wrap-regex": "off",
"yield-star-spacing": Array [
"error",
"after",
],
"yoda": "error",
},
"settings": Object {
"flowtype": Object {
"onlyFilesWithFlowAnnotation": false,
},
"import/core-modules": Array [],
"import/extensions": Array [
".js",
".jsx",
],
"import/ignore": Array [
"node_modules",
"\\.(coffee|scss|css|less|hbs|svg|json)$",
],
"import/resolver": Object {
"node": Object {
"extensions": Array [
".js",
".jsx",
".json",
],
},
},
"react": Object {
"pragma": "React",
"version": "0.14",
},
},
"useEslintrc": false,
},
"eslintPath": "/Users/awesome/Sites/maggie/node_modules/eslint",
"filePath": "packages/editor/modules/entities/index.js",
"logLevel": "trace",
"prettierOptions": Object {
"bracketSpacing": false,
"parser": "babylon",
"printWidth": 100,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": true,
},
"prettierPath": "/Users/awesome/Sites/maggie/node_modules/prettier",
"text": "// @flow
import * as query from \"shared/query\";
import * as stateKeys from \"modules/entities/stateKeys\";
import resourceReducer from \"./resources\";
import type { StateKey, State } from \"./stateKeys\";
import {
INSERT_ENTITY,
REMOVE_ENTITY,
UPDATE_ENTITY_STYLE,
UPDATE_ENTITY_ORDER,
REMOVE_REFERENCE_FROM_PARENT,
// STORE_ARTICLE,
UPDATE_ARTICLE_WITH_SECTION,
UPDATE_SECTION_WITH_COLUMN_ID,
UPDATE_COLUMN_ITEM_DATA,
UPDATE_SECTION_COLUMN_WITH_COLUMN_ITEM,
MOVE_ENTITY_BETWEEN_PARENT
} from \"./constants\";
// fill the initialState dynamically.
const initialState = {};
Object.keys(stateKeys).forEach(key => {
initialState[key] = {
entities: {},
results: []
};
});
export default function entitiesReducer(
state: State = initialState,
action: Object
): State {
switch (action.type) {
case INSERT_ENTITY: {
const entityData = action.payload;
const { type, id } = entityData;
return insertNewEntity(type, id, entityData, state);
}
case UPDATE_ENTITY_STYLE: {
const { sectionId, styleKey, styleValue, type } = action.payload;
return query.upsert$(
[type, \"entities\", sectionId, \"attributes\", \"style\", styleKey],
styleValue,
state
);
}
case REMOVE_ENTITY: {
const { stateKey, id } = action.payload;
return removeEntity(stateKey, id, state);
}
case REMOVE_REFERENCE_FROM_PARENT: {
const { parentType, parentId, childId } = action.payload;
return query.pullByKey$(
[parentType, \"entities\", parentId, \"childItems\"],
\"id\",
childId,
state
);
}
case MOVE_ENTITY_BETWEEN_PARENT: {
const {
curParentId,
nextParentId,
entityId,
parentType
} = action.payload;
return moveEntityBetweenParents(
parentType,
curParentId,
nextParentId,
entityId,
state
);
}
case UPDATE_ENTITY_ORDER: {
const { oldIndex, newIndex, entityId, entityType } = action.payload;
return query.swapIn$(
[entityType, \"entities\", entityId, \"childItems\"],
oldIndex,
newIndex,
state
);
}
case UPDATE_ARTICLE_WITH_SECTION: {
console.debug(
\"%c🕵 UPDATE_ARTICLE_WITH_SECTION must be generalized\",
\"background: blue; color: white; font-size: 1.5em\"
);
const { sectionId, articleId } = action.payload;
return query.append$(
[stateKeys.ARTICLE, \"entities\", articleId, \"childItems\"],
sectionId,
state
);
}
case UPDATE_SECTION_WITH_COLUMN_ID: {
console.debug(
\"%c👮 UPDATE_SECTION_WITH_COLUMN_ID must be generalized\",
\"background: red; color: white; font-size: 1.5em\"
);
const { sectionId, columnItemId } = action.payload;
return query.append$(
[stateKeys.SECTION, \"entities\", sectionId, \"childItems\"],
columnItemId,
state
);
}
case UPDATE_COLUMN_ITEM_DATA: {
console.debug(
\"%c🕵 UPDATE_COLUMN_ITEM_DATA must be generalized\",
\"background: blue; color: white; font-size: 1.5em\"
);
const {
columnItemId,
columnItemData,
type
} = action.payload;
return query.upsert$(
[type, \"entities\", columnItemId, \"data\"],
columnItemData,
state
);
}
case UPDATE_SECTION_COLUMN_WITH_COLUMN_ITEM: {
console.debug(
\"%c🕵 UPDATE_SECTION_COLUMN_WITH_COLUMN_ITEM must be generalized\",
\"background: blue; color: white; font-size: 1.5em\"
);
const { columnId, columItemData } = action.payload;
return query.append$(
[stateKeys.SECTION_COLUMN, \"entities\", columnId, \"childItems\"],
columItemData,
state
);
}
default:
return resourceReducer(state, action); // return state;
}
} // *************************** // Reducer helper functions ** // https://github.com/reactjs/redux/issues/1171 => complex logic in // reducers seems fine. // ***************************
const insertNewEntity = (
stateKey: StateKey,
id: String,
entityData: Object,
state: State
) =>
query.upsert$(
[stateKey, \"entities\", id],
entityData,
query.append$([stateKey, \"results\"], id, state)
);
const removeEntity = (stateKey: StateKey, id: String, state: State): State =>
query.omit$(
[stateKey, \"entities\"],
id,
query.pull$([stateKey, \"entities\"], id, state)
);
const moveEntityBetweenParents = (
parentType: StateKey,
curParentId: String,
nextParentId: String,
entityId: String,
state: Object
) => {
const entity = query.findIn$(
[parentType, \"entities\", curParentId, \"childItems\"],
\"id\",
entityId,
state
);
return query.append$(
[stateKeys.SECTION_COLUMN, \"entities\", nextParentId, \"childItems\"],
entity,
query.pullByKey$(
[parentType, \"entities\", curParentId, \"childItems\"],
\"id\",
entityId,
state
)
);
};
",
}
prettier-eslint [DEBUG]: calling prettier on text
Trace: prettier-eslint [TRACE]: prettier input:
// @flow
import * as query from "shared/query";
import * as stateKeys from "modules/entities/stateKeys";
import resourceReducer from "./resources";
import type { StateKey, State } from "./stateKeys";
import {
INSERT_ENTITY,
REMOVE_ENTITY,
UPDATE_ENTITY_STYLE,
UPDATE_ENTITY_ORDER,
REMOVE_REFERENCE_FROM_PARENT,
// STORE_ARTICLE,
UPDATE_ARTICLE_WITH_SECTION,
UPDATE_SECTION_WITH_COLUMN_ID,
UPDATE_COLUMN_ITEM_DATA,
UPDATE_SECTION_COLUMN_WITH_COLUMN_ITEM,
MOVE_ENTITY_BETWEEN_PARENT
} from "./constants";
// fill the initialState dynamically.
const initialState = {};
Object.keys(stateKeys).forEach(key => {
initialState[key] = {
entities: {},
results: []
};
});
export default function entitiesReducer(
state: State = initialState,
action: Object
): State {
switch (action.type) {
case INSERT_ENTITY: {
const entityData = action.payload;
const { type, id } = entityData;
return insertNewEntity(type, id, entityData, state);
}
case UPDATE_ENTITY_STYLE: {
const { sectionId, styleKey, styleValue, type } = action.payload;
return query.upsert$(
[type, "entities", sectionId, "attributes", "style", styleKey],
styleValue,
state
);
}
case REMOVE_ENTITY: {
const { stateKey, id } = action.payload;
return removeEntity(stateKey, id, state);
}
case REMOVE_REFERENCE_FROM_PARENT: {
const { parentType, parentId, childId } = action.payload;
return query.pullByKey$(
[parentType, "entities", parentId, "childItems"],
"id",
childId,
state
);
}
case MOVE_ENTITY_BETWEEN_PARENT: {
const {
curParentId,
nextParentId,
entityId,
parentType
} = action.payload;
return moveEntityBetweenParents(
parentType,
curParentId,
nextParentId,
entityId,
state
);
}
case UPDATE_ENTITY_ORDER: {
const { oldIndex, newIndex, entityId, entityType } = action.payload;
return query.swapIn$(
[entityType, "entities", entityId, "childItems"],
oldIndex,
newIndex,
state
);
}
case UPDATE_ARTICLE_WITH_SECTION: {
console.debug(
"%c🕵 UPDATE_ARTICLE_WITH_SECTION must be generalized",
"background: blue; color: white; font-size: 1.5em"
);
const { sectionId, articleId } = action.payload;
return query.append$(
[stateKeys.ARTICLE, "entities", articleId, "childItems"],
sectionId,
state
);
}
case UPDATE_SECTION_WITH_COLUMN_ID: {
console.debug(
"%c👮 UPDATE_SECTION_WITH_COLUMN_ID must be generalized",
"background: red; color: white; font-size: 1.5em"
);
const { sectionId, columnItemId } = action.payload;
return query.append$(
[stateKeys.SECTION, "entities", sectionId, "childItems"],
columnItemId,
state
);
}
case UPDATE_COLUMN_ITEM_DATA: {
console.debug(
"%c🕵 UPDATE_COLUMN_ITEM_DATA must be generalized",
"background: blue; color: white; font-size: 1.5em"
);
const {
columnItemId,
columnItemData,
type
} = action.payload;
return query.upsert$(
[type, "entities", columnItemId, "data"],
columnItemData,
state
);
}
case UPDATE_SECTION_COLUMN_WITH_COLUMN_ITEM: {
console.debug(
"%c🕵 UPDATE_SECTION_COLUMN_WITH_COLUMN_ITEM must be generalized",
"background: blue; color: white; font-size: 1.5em"
);
const { columnId, columItemData } = action.payload;
return query.append$(
[stateKeys.SECTION_COLUMN, "entities", columnId, "childItems"],
columItemData,
state
);
}
default:
return resourceReducer(state, action); // return state;
}
} // *************************** // Reducer helper functions ** // https://github.com/reactjs/redux/issues/1171 => complex logic in // reducers seems fine. // ***************************
const insertNewEntity = (
stateKey: StateKey,
id: String,
entityData: Object,
state: State
) =>
query.upsert$(
[stateKey, "entities", id],
entityData,
query.append$([stateKey, "results"], id, state)
);
const removeEntity = (stateKey: StateKey, id: String, state: State): State =>
query.omit$(
[stateKey, "entities"],
id,
query.pull$([stateKey, "entities"], id, state)
);
const moveEntityBetweenParents = (
parentType: StateKey,
curParentId: String,
nextParentId: String,
entityId: String,
state: Object
) => {
const entity = query.findIn$(
[parentType, "entities", curParentId, "childItems"],
"id",
entityId,
state
);
return query.append$(
[stateKeys.SECTION_COLUMN, "entities", nextParentId, "childItems"],
entity,
query.pullByKey$(
[parentType, "entities", curParentId, "childItems"],
"id",
entityId,
state
)
);
};
at Logger.trace (/Users/awesome/Sites/maggie/node_modules/prettier-eslint/dist/log.js:60:24)
at format (/Users/awesome/Sites/maggie/node_modules/prettier-eslint/dist/index.js:103:10)
at MapSubscriber.project (/Users/awesome/Sites/maggie/node_modules/prettier-eslint-cli/dist/format-files.js:264:55)
at MapSubscriber._next (/Users/awesome/Sites/maggie/node_modules/rxjs/operator/map.js:77:35)
at MapSubscriber.Subscriber.next (/Users/awesome/Sites/maggie/node_modules/rxjs/Subscriber.js:89:18)
at AsyncSubject.Subject.next (/Users/awesome/Sites/maggie/node_modules/rxjs/Subject.js:55:25)
at AsyncSubject.complete (/Users/awesome/Sites/maggie/node_modules/rxjs/AsyncSubject.js:46:35)
at handlerFn (/Users/awesome/Sites/maggie/node_modules/rxjs/observable/BoundNodeCallbackObservable.js:193:33)
at tryToString (fs.js:449:3)
at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:436:12)
Trace: prettier-eslint [TRACE]: requiring prettier module at "/Users/awesome/Sites/maggie/node_modules/prettier"
at Logger.trace (/Users/awesome/Sites/maggie/node_modules/prettier-eslint/dist/log.js:60:24)
at prettify (/Users/awesome/Sites/maggie/node_modules/prettier-eslint/dist/index.js:114:12)
at format (/Users/awesome/Sites/maggie/node_modules/prettier-eslint/dist/index.js:104:16)
at MapSubscriber.project (/Users/awesome/Sites/maggie/node_modules/prettier-eslint-cli/dist/format-files.js:264:55)
at MapSubscriber._next (/Users/awesome/Sites/maggie/node_modules/rxjs/operator/map.js:77:35)
at MapSubscriber.Subscriber.next (/Users/awesome/Sites/maggie/node_modules/rxjs/Subscriber.js:89:18)
at AsyncSubject.Subject.next (/Users/awesome/Sites/maggie/node_modules/rxjs/Subject.js:55:25)
at AsyncSubject.complete (/Users/awesome/Sites/maggie/node_modules/rxjs/AsyncSubject.js:46:35)
at handlerFn (/Users/awesome/Sites/maggie/node_modules/rxjs/observable/BoundNodeCallbackObservable.js:193:33)
at tryToString (fs.js:449:3)
Trace: prettier-eslint [TRACE]: calling prettier.format with the text and prettierOptions
at Logger.trace (/Users/awesome/Sites/maggie/node_modules/prettier-eslint/dist/log.js:60:24)
at prettify (/Users/awesome/Sites/maggie/node_modules/prettier-eslint/dist/index.js:121:12)
at format (/Users/awesome/Sites/maggie/node_modules/prettier-eslint/dist/index.js:104:16)
at MapSubscriber.project (/Users/awesome/Sites/maggie/node_modules/prettier-eslint-cli/dist/format-files.js:264:55)
at MapSubscriber._next (/Users/awesome/Sites/maggie/node_modules/rxjs/operator/map.js:77:35)
at MapSubscriber.Subscriber.next (/Users/awesome/Sites/maggie/node_modules/rxjs/Subscriber.js:89:18)
at AsyncSubject.Subject.next (/Users/awesome/Sites/maggie/node_modules/rxjs/Subject.js:55:25)
at AsyncSubject.complete (/Users/awesome/Sites/maggie/node_modules/rxjs/AsyncSubject.js:46:35)
at handlerFn (/Users/awesome/Sites/maggie/node_modules/rxjs/observable/BoundNodeCallbackObservable.js:193:33)
at tryToString (fs.js:449:3)
Trace: prettier-eslint [TRACE]: prettier: output === input false
at Logger.trace (/Users/awesome/Sites/maggie/node_modules/prettier-eslint/dist/log.js:60:24)
at prettify (/Users/awesome/Sites/maggie/node_modules/prettier-eslint/dist/index.js:123:12)
at format (/Users/awesome/Sites/maggie/node_modules/prettier-eslint/dist/index.js:104:16)
at MapSubscriber.project (/Users/awesome/Sites/maggie/node_modules/prettier-eslint-cli/dist/format-files.js:264:55)
at MapSubscriber._next (/Users/awesome/Sites/maggie/node_modules/rxjs/operator/map.js:77:35)
at MapSubscriber.Subscriber.next (/Users/awesome/Sites/maggie/node_modules/rxjs/Subscriber.js:89:18)
at AsyncSubject.Subject.next (/Users/awesome/Sites/maggie/node_modules/rxjs/Subject.js:55:25)
at AsyncSubject.complete (/Users/awesome/Sites/maggie/node_modules/rxjs/AsyncSubject.js:46:35)
at handlerFn (/Users/awesome/Sites/maggie/node_modules/rxjs/observable/BoundNodeCallbackObservable.js:193:33)
at tryToString (fs.js:449:3)
Trace: prettier-eslint [TRACE]: prettier output (eslint input):
// @flow
import * as query from 'shared/query';
import * as stateKeys from 'modules/entities/stateKeys';
import resourceReducer from './resources';
import type {StateKey, State} from './stateKeys';
import {
INSERT_ENTITY,
REMOVE_ENTITY,
UPDATE_ENTITY_STYLE,
UPDATE_ENTITY_ORDER,
REMOVE_REFERENCE_FROM_PARENT,
// STORE_ARTICLE,
UPDATE_ARTICLE_WITH_SECTION,
UPDATE_SECTION_WITH_COLUMN_ID,
UPDATE_COLUMN_ITEM_DATA,
UPDATE_SECTION_COLUMN_WITH_COLUMN_ITEM,
MOVE_ENTITY_BETWEEN_PARENT,
} from './constants';
// fill the initialState dynamically.
const initialState = {};
Object.keys(stateKeys).forEach(key => {
initialState[key] = {
entities: {},
results: [],
};
});
export default function entitiesReducer(state: State = initialState, action: Object): State {
switch (action.type) {
case INSERT_ENTITY: {
const entityData = action.payload;
const {type, id} = entityData;
return insertNewEntity(type, id, entityData, state);
}
case UPDATE_ENTITY_STYLE: {
const {sectionId, styleKey, styleValue, type} = action.payload;
return query.upsert$(
[type, 'entities', sectionId, 'attributes', 'style', styleKey],
styleValue,
state,
);
}
case REMOVE_ENTITY: {
const {stateKey, id} = action.payload;
return removeEntity(stateKey, id, state);
}
case REMOVE_REFERENCE_FROM_PARENT: {
const {parentType, parentId, childId} = action.payload;
return query.pullByKey$(
[parentType, 'entities', parentId, 'childItems'],
'id',
childId,
state,
);
}
case MOVE_ENTITY_BETWEEN_PARENT: {
const {
curParentId,
nextParentId,
entityId,
parentType,
} = action.payload;
return moveEntityBetweenParents(parentType, curParentId, nextParentId, entityId, state);
}
case UPDATE_ENTITY_ORDER: {
const {oldIndex, newIndex, entityId, entityType} = action.payload;
return query.swapIn$(
[entityType, 'entities', entityId, 'childItems'],
oldIndex,
newIndex,
state,
);
}
case UPDATE_ARTICLE_WITH_SECTION: {
console.debug(
'%c🕵 UPDATE_ARTICLE_WITH_SECTION must be generalized',
'background: blue; color: white; font-size: 1.5em',
);
const {sectionId, articleId} = action.payload;
return query.append$(
[stateKeys.ARTICLE, 'entities', articleId, 'childItems'],
sectionId,
state,
);
}
case UPDATE_SECTION_WITH_COLUMN_ID: {
console.debug(
'%c👮 UPDATE_SECTION_WITH_COLUMN_ID must be generalized',
'background: red; color: white; font-size: 1.5em',
);
const {sectionId, columnItemId} = action.payload;
return query.append$(
[stateKeys.SECTION, 'entities', sectionId, 'childItems'],
columnItemId,
state,
);
}
case UPDATE_COLUMN_ITEM_DATA: {
console.debug(
'%c🕵 UPDATE_COLUMN_ITEM_DATA must be generalized',
'background: blue; color: white; font-size: 1.5em',
);
const {
columnItemId,
columnItemData,
type,
} = action.payload;
return query.upsert$([type, 'entities', columnItemId, 'data'], columnItemData, state);
}
case UPDATE_SECTION_COLUMN_WITH_COLUMN_ITEM: {
console.debug(
'%c🕵 UPDATE_SECTION_COLUMN_WITH_COLUMN_ITEM must be generalized',
'background: blue; color: white; font-size: 1.5em',
);
const {columnId, columItemData} = action.payload;
return query.append$(
[stateKeys.SECTION_COLUMN, 'entities', columnId, 'childItems'],
columItemData,
state,
);
}
default:
return resourceReducer(state, action); // return state;
}
} // *************************** // Reducer helper functions ** // https://github.com/reactjs/redux/issues/1171 => complex logic in // reducers seems fine. // ***************************
const insertNewEntity = (stateKey: StateKey, id: String, entityData: Object, state: State) =>
query.upsert$(
[stateKey, 'entities', id],
entityData,
query.append$([stateKey, 'results'], id, state),
);
const removeEntity = (stateKey: StateKey, id: String, state: State): State =>
query.omit$([stateKey, 'entities'], id, query.pull$([stateKey, 'entities'], id, state));
const moveEntityBetweenParents = (
parentType: StateKey,
curParentId: String,
nextParentId: String,
entityId: String,
state: Object,
) => {
const entity = query.findIn$(
[parentType, 'entities', curParentId, 'childItems'],
'id',
entityId,
state,
);
return query.append$(
[stateKeys.SECTION_COLUMN, 'entities', nextParentId, 'childItems'],
entity,
query.pullByKey$([parentType, 'entities', curParentId, 'childItems'], 'id', entityId, state),
);
};
at Logger.trace (/Users/awesome/Sites/maggie/node_modules/prettier-eslint/dist/log.js:60:24)
at format (/Users/awesome/Sites/maggie/node_modules/prettier-eslint/dist/index.js:105:10)
at MapSubscriber.project (/Users/awesome/Sites/maggie/node_modules/prettier-eslint-cli/dist/format-files.js:264:55)
at MapSubscriber._next (/Users/awesome/Sites/maggie/node_modules/rxjs/operator/map.js:77:35)
at MapSubscriber.Subscriber.next (/Users/awesome/Sites/maggie/node_modules/rxjs/Subscriber.js:89:18)
at AsyncSubject.Subject.next (/Users/awesome/Sites/maggie/node_modules/rxjs/Subject.js:55:25)
at AsyncSubject.complete (/Users/awesome/Sites/maggie/node_modules/rxjs/AsyncSubject.js:46:35)
at handlerFn (/Users/awesome/Sites/maggie/node_modules/rxjs/observable/BoundNodeCallbackObservable.js:193:33)
at tryToString (fs.js:449:3)
at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:436:12)
Trace: prettier-eslint [TRACE]: requiring eslint module at "/Users/awesome/Sites/maggie/node_modules/eslint"
at Logger.trace (/Users/awesome/Sites/maggie/node_modules/prettier-eslint/dist/log.js:60:24)
at getESLintCLIEngine (/Users/awesome/Sites/maggie/node_modules/prettier-eslint/dist/index.js:199:12)
at eslintFix (/Users/awesome/Sites/maggie/node_modules/prettier-eslint/dist/index.js:132:16)
at format (/Users/awesome/Sites/maggie/node_modules/prettier-eslint/dist/index.js:106:21)
at MapSubscriber.project (/Users/awesome/Sites/maggie/node_modules/prettier-eslint-cli/dist/format-files.js:264:55)
at MapSubscriber._next (/Users/awesome/Sites/maggie/node_modules/rxjs/operator/map.js:77:35)
at MapSubscriber.Subscriber.next (/Users/awesome/Sites/maggie/node_modules/rxjs/Subscriber.js:89:18)
at AsyncSubject.Subject.next (/Users/awesome/Sites/maggie/node_modules/rxjs/Subject.js:55:25)
at AsyncSubject.complete (/Users/awesome/Sites/maggie/node_modules/rxjs/AsyncSubject.js:46:35)
at handlerFn (/Users/awesome/Sites/maggie/node_modules/rxjs/observable/BoundNodeCallbackObservable.js:193:33)
Trace: prettier-eslint [TRACE]: calling eslint.executeOnText with the text
at Logger.trace (/Users/awesome/Sites/maggie/node_modules/prettier-eslint/dist/log.js:60:24)
at eslintFix (/Users/awesome/Sites/maggie/node_modules/prettier-eslint/dist/index.js:134:12)
at format (/Users/awesome/Sites/maggie/node_modules/prettier-eslint/dist/index.js:106:21)
at MapSubscriber.project (/Users/awesome/Sites/maggie/node_modules/prettier-eslint-cli/dist/format-files.js:264:55)
at MapSubscriber._next (/Users/awesome/Sites/maggie/node_modules/rxjs/operator/map.js:77:35)
at MapSubscriber.Subscriber.next (/Users/awesome/Sites/maggie/node_modules/rxjs/Subscriber.js:89:18)
at AsyncSubject.Subject.next (/Users/awesome/Sites/maggie/node_modules/rxjs/Subject.js:55:25)
at AsyncSubject.complete (/Users/awesome/Sites/maggie/node_modules/rxjs/AsyncSubject.js:46:35)
at handlerFn (/Users/awesome/Sites/maggie/node_modules/rxjs/observable/BoundNodeCallbackObservable.js:193:33)
at tryToString (fs.js:449:3)
prettier-eslint [ERROR]: eslint fix failed due to an eslint error
failure formatting 1 file with prettier-eslint
Issue Analytics
- State:
- Created 7 years ago
- Comments:13 (5 by maintainers)
Top Results From Across the Web
Options - Prettier
Specify which parser to use. Prettier automatically infers the parser from the input file path, so you shouldn't have to change this setting....
Read more >prettier-eslint - npm
inferring prettierOptions via eslintConfig If the eslintConfig is not provided, then prettier-eslint will look for them based on the fileName ( ...
Read more >eslint-plugin-prettier | Yarn - Package Manager
Options. Note: While it is possible to pass options to Prettier via your ESLint configuration file, it is not recommended because editor extensions...
Read more >Prettier, ESLint and Typescript - LinkedIn
We can use the --fix option, which works similar to --write from Prettier, ... First let's go and install eslint-config-prettier:
Read more >Configuration Files - ESLint - Pluggable JavaScript Linter
ESLint supports adding shared settings into configuration files. Plugins use settings to specify the information that should be shared across all of its...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Can you post a screenshot of your settings?
If you’re using the CLI, this may be nice to document in the
prettier-eslint-cli
docs too…I can have a look.