Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add eslint-plugin-import #74

Closed
SgtPooki opened this issue Jan 24, 2023 · 1 comment
Closed

chore: add eslint-plugin-import #74

SgtPooki opened this issue Jan 24, 2023 · 1 comment

Comments

@SgtPooki
Copy link
Member

We should use something similar to:

    rules: {
        'import/order': [
            'error',
            {
                alphabetize: {
                    order: 'asc',
                    caseInsensitive: false,
                },
                'newlines-between': 'always',
                // the overall order of imports
                groups: ['builtin', 'external', 'internal', ['sibling', 'parent', 'index'], 'object'],
                pathGroupsExcludedImportTypes: ['builtin'],
                pathGroups: [
                    { // 3p imports
                        pattern: '+(!(@))*/**',
                        group: 'external',
                        position: 'before',
                        patternOptions: { nonegate: true },
                    },
                    { // scoped external imports excluding our 2p scoped packages
                        pattern: '@!(ipfs|libp2p|ipfs-shipyard|ipld|multiformats)/**',
                        group: 'external',
                        position: 'after',
                        patternOptions: { nonegate: false },
                    },
                    { // our 2p scoped packages
                        pattern: '@{ipfs,libp2p,ipfs-shipyard,ipld,multiformats}/**',
                        group: 'parent',
                        position: 'before',
                        patternOptions: { nonegate: true },
                    },
                    { // our relative (this package) imports
                        pattern: '.*/**',
                        group: 'index',
                        position: 'after',
                        patternOptions: { dot: true, nonegate: true },
                    },
                ],
            },
        ],
@SgtPooki
Copy link
Member Author

Closing in favor of ipfs/eslint-config-ipfs#126 and ipfs/aegir#1178

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant