0

I have prettier installed in my Atom editor. I enabled autosave option. but on auto save when it changes useEffect dependency array most of time. I don't want atom to auto add element in dependency array. I would really appreciate if someone can guide me to the prettier config which enables / disables this feature -

following are example of changes.

Original:

useEffect(() => {
    dispatch(fetchListPlants());
}, []);

After Autosave:

useEffect(() => {
    dispatch(fetchListPlants());
}, [dispatch]);

Original:

useEffect(() => {
    geocoder.addTo('#geocoder');
    dispatch(fetchListQuotes());
}, []);

After Autosave:

useEffect(() => {
    geocoder.addTo('#geocoder');
    dispatch(fetchListQuotes());
}, [geocoder, dispatch]);

My Prettier.json

{
    "arrowParens": "avoid",
    "bracketSpacing": true,
    "endOfLine": "auto",
    "htmlWhitespaceSensitivity": "css",
    "insertPragma": false,
    "jsxBracketSameLine": true,
    "jsxSingleQuote": true,
    "printWidth": 120,
    "proseWrap": "preserve",
    "quoteProps": "as-needed",
    "requirePragma": false,
    "semi": true,
    "singleQuote": true,
    "tabWidth": 4,
    "trailingComma": "none",
    "useTabs": false,
    "vueIndentScriptAndStyle": false
  }
Mani
  • 2,391
  • 5
  • 37
  • 81
  • Why do you suspect a code-formatter to alter your code functionality. That's not what `prettier` does. – idleberg Sep 03 '21 at 22:33
  • @idleberg because when I disable this one package and save. dependencies doesn't get added automatically – Mani Sep 07 '21 at 07:27

1 Answers1

0

Looking at the dependencies of prettier-atom, I'm suspecting that the ESLint integration might be causing this. ESLint reports missing dependencies for useEffect(), but I'm not sure if that rule falls in the category of fixable errors.

Either way, try disabling the ESLint Integration in the prettier-atom settings to see if the problem persists:

enter image description here

You can find the settings of that Atom package at Settings > Packages > prettier-atom

idleberg
  • 12,634
  • 7
  • 43
  • 70