question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to handle the confliction with `import/first`?

See original GitHub issue

This is after the format:

import { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useShareAppMessage, useShareTimeline } from '@tarojs/taro';
import Table, { Columns } from 'taro-react-table';
import { useAppDispatch, useAppSelector } from '../../store/hooks';

import 'taro-react-table/dist/index.css';  // <----ESLint: Absolute imports should come before relative imports.(import/first)
import './index.scss';

My .eslintrc.js

module.exports = {
  extends: ['taro/react', 'plugin:prettier/recommended'],
  plugins: ['simple-import-sort', 'import'],
  rules: {
    'react/jsx-uses-react': 'off',
    'react/react-in-jsx-scope': 'off',
    'import/order': 'off',
    'import/first': 'warn',
    'import/newline-after-import': 'warn',
    'import/no-duplicates': 'warn',
    'simple-import-sort/imports': 'warn',
    'simple-import-sort/exports': 'warn',
  },
  overrides: [
    // override "simple-import-sort" config
    {
      files: ['*.js', '*.jsx', '*.ts', '*.tsx'],
      rules: {
        'simple-import-sort/imports': [
          'warn',
          {
            groups: [
              [
                // Packages `react` related packages come first.
                '^react',
                '^@?\\w',
                // Internal packages.
                '^(@|components)(/.*|$)',
                // Side effect imports.
                '^\\u0000',
                // Parent imports. Put `..` last.
                '^\\.\\.(?!/?$)',
                '^\\.\\./?$',
                // Other relative imports. Put same-folder imports and `.` last.
                '^\\./(?=.*/)(?!/?$)',
                '^\\.(?!/?$)',
                '^\\./?$',
              ],
              // Style imports.
              ['^.+\\.?(sc|sa|c)ss$'],
            ],
          },
        ],
      },
    },
  ],
};

Note: taro/react contains import/order, so I turned the rule off.

Thanks.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
hellointcommented, Nov 7, 2022
1reaction
hellointcommented, Nov 4, 2022

oh, my wrong, the topic is incorrect. the eslint-plugin-simple-import-sort do put the absolute css to the last group, just the import/first throws warning…

Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Handle Workplace Conflict (With Tips and Examples)
How to handle conflict in the workplace · 1. Foster relationships with colleagues · 2. Communication is key · 3. Learn to listen...
Read more >
Git merge conflicts | Atlassian Git Tutorial
The git merge command's primary responsibility is to combine separate branches and resolve any conflicting edits. Understanding merge conflicts. Merging and ...
Read more >
7 Tips on How to Manage and Resolve Conflict in the Workplace
“Establishing conflict management processes in a company is fundamental as it helps reduce conflict instances among employees,'' says Casper Hansen, an expert ...
Read more >
Resolving a merge conflict using the command line
You can resolve merge conflicts using the command line and a text editor. MacWindowsLinux. Merge conflicts occur when competing changes are made to...
Read more >
Tips for Managing Conflict - Clarke University
Accept conflict. Remember that conflict is natural and happens in every ongoing relationship. Since conflict is unavoidable we must learn to manage it....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found