From fda7d69b38e7def677a4605873ae98d179cb5548 Mon Sep 17 00:00:00 2001 From: Moti Zilberman Date: Mon, 6 Nov 2023 12:59:38 -0800 Subject: [PATCH] Enable lint/sort-imports everywhere (#41333) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/41333 Enables the `sort-imports` lint rule introduced in D39907799 in ~all files, rather than just in `react-native/Libraries`. We exclude only `packages/react-native/template`, in order to (1) minimise noise for projects that are tracking updates to the template, (2) avoid the possibility of something breaking if the `react-native` import isn't at the top of `template/index.js`, (3) avoid leaking a reference to `lint/sort-imports` to the template (which doesn't ship with this rule) via an ESLint suppression comment. Changelog: [Internal] Reviewed By: robhogan Differential Revision: D51025811 fbshipit-source-id: a62b0d6ebc5323116a4b2f1b69c4e8d48cde3215 --- .eslintrc.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.eslintrc.js b/.eslintrc.js index f14dc495f23..a72eae244cc 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -34,6 +34,13 @@ module.exports = { 'no-undef': 0, }, }, + { + files: ['*.js', '*.js.flow'], + excludedFiles: ['packages/react-native/template/**/*'], + rules: { + 'lint/sort-imports': 1, + }, + }, { files: ['package.json'], parser: 'jsonc-eslint-parser', @@ -60,7 +67,6 @@ module.exports = { 'lint/no-haste-imports': 2, 'lint/no-react-native-imports': 2, 'lint/require-extends-error': 2, - 'lint/sort-imports': 1, }, }, {