Skip to content

Commit e4b62bb

Browse files
iRoachiefacebook-github-bot
authored andcommitted
fix(eslint-config): Clashes with prettier (#26847)
Summary: Currently, react-native-community config package extends from prettier/recommended which comes with default settings from prettier. However there are still some eslint rules in the config that either clash or duplicate the settings from prettier. This results in eslint fixing the formatting and then prettier undoing it. This PR removes the style specific rules from eslint and place them in the prettier section. ## Changelog [General] [Fixed] - Remove style rules from eslint config for prettier options Pull Request resolved: #26847 Test Plan: I created a repo for you to test with https://github.com/iRoachie/eslint-bug-replicate. You can see that running `yarn lint --fix` will never fix the issue. Eslint will complain about double quotes and subsequently after fixing it will complain about single quotes. Here's a gif of the behaviour (vscode eslint plugin `"eslint.autoFixOnSave": true`): ![Kapture 2019-10-13 at 23 34 15](https://user-images.githubusercontent.com/5962998/66728290-ff80da00-ee11-11e9-8993-4d1b679c270b.gif) Differential Revision: D18173919 Pulled By: cpojer fbshipit-source-id: b333469652b4c8e72287718af94378505e9b7d59
1 parent 2f8328d commit e4b62bb

File tree

1 file changed

+9
-3
lines changed
  • packages/eslint-config-react-native-community

1 file changed

+9
-3
lines changed

packages/eslint-config-react-native-community/index.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ module.exports = {
112112

113113
rules: {
114114
// General
115-
'comma-dangle': [1, 'always-multiline'], // allow or disallow trailing commas
115+
'comma-dangle': 0, // allow or disallow trailing commas (off by default)
116116
'no-cond-assign': 1, // disallow assignment in conditional expressions
117117
'no-console': 0, // disallow use of console (off by default in the node environment)
118118
'no-const-assign': 2, // disallow assignment to const-declared variables
@@ -250,9 +250,9 @@ module.exports = {
250250
'no-trailing-spaces': 1, // disallow trailing whitespace at the end of lines
251251
'no-underscore-dangle': 0, // disallow dangling underscores in identifiers
252252
'no-mixed-spaces-and-tabs': 1, // disallow mixed spaces and tabs for indentation
253-
quotes: [1, 'single', 'avoid-escape'], // specify whether double or single quotes should be used
253+
quotes: 0, // specify whether double or single quotes should be used (off by default)
254254
'quote-props': 0, // require quotes around object literal property names (off by default)
255-
semi: 1, // require or disallow use of semicolons instead of ASI
255+
semi: 0, // require or disallow use of semicolons instead of ASI (off by default)
256256
'sort-vars': 0, // sort variables within the same declaration block (off by default)
257257
'space-in-brackets': 0, // require or disallow spaces inside brackets (off by default)
258258
'space-in-parens': 0, // require or disallow spaces inside parentheses (off by default)
@@ -309,5 +309,11 @@ module.exports = {
309309
'jest/no-focused-tests': 1,
310310
'jest/no-identical-title': 1,
311311
'jest/valid-expect': 1,
312+
313+
// Prettier Plugin
314+
'prettier/prettier': [
315+
1,
316+
{singleQuote: true, trailingComma: 'es5', semi: true},
317+
],
312318
},
313319
};

0 commit comments

Comments
 (0)