ipfs-shipyard / ignite-metrics

Metrics consent and client provider library for ipfs/ipfs-gui team (i.e. IPFS Ignite). See ipfs/ipfs-gui#129 for more details
Other
4 stars 3 forks source link

chore: add eslint-plugin-import #74

Closed SgtPooki closed 1 year ago

SgtPooki commented 1 year ago

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 commented 1 year ago

Closing in favor of https://github.com/ipfs/eslint-config-ipfs/pull/126 and https://github.com/ipfs/aegir/pull/1178