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.

Add "unassigned" to importType for order rule

See original GitHub issue

I would like to group and order unassigned imports. This specific use case is for importing Polymer 2 html elements with polymer-webpack-loader.

import { Component } from '@angular/core';

import 'bower_components/paper-button/paper-button.html';

import { value } from '../parent'; 
import { other } from './sibling';

The proposed .eslintrc to achieve the above style would be

"import/order": [
  "error", 
  {
    "groups": ["builtin", "external", "unassigned", ["parent", "sibling", "index"]],
    "newlines-between": "always"
  }
]

At the moment unassigned imports are completely ignored.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:5
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

7reactions
constgencommented, Jul 23, 2020

@ljharb As I described above sometimes it may be important. Preserving the necessary order for the particular project may be highly necessary. To not make breaking changes I propose to add an option to pathGroups so consumers may enable processing of side affect imports for certain groups. E.g.:

"pathGroups": [
  {
    "pattern": "{.,..}/**/*.+(css|sass|less|scss|pcss|styl)",
    "unnamed": true, // this is a new option
    "group": "unknown",
    "position": "after"
  }
]
1reaction
ljharbcommented, Nov 17, 2017

This seems reasonable; altho I’d call them “side-effecting” or something instead of just “unassigned”.

A use case that isn’t deprecated (ie, that doesn’t involve bower) would be shimming/polyfilling.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Add "unassigned" to importType for order rule #970 - GitHub
I would like to group and order unassigned imports. This specific use case is for importing Polymer 2 html elements with polymer-webpack-loader.
Read more >
eslint-plugin-import | Yarn - Package Manager
This plugin intends to support linting of ES2015+ (ES6+) import/export syntax, and prevent issues with misspelling of file paths and import names. All...
Read more >
NetSuite Applications Suite - Oracle Help Center
Any line labeled Unassigned in this report includes transactions with items that do not have an associated deferred expense account.
Read more >
client/node_modules/eslint-plugin-import/CHANGELOG.md
2.10.0 - 2018-03-29. Added. Autofixer for order rule (#908, thanks @tihonove); Add no-cycle rule: reports import ...
Read more >
Paycom University Employee Management Guide
Each document added will display in the Documents tab. If needed, click and drag to rearrange the order the documents will display. If...
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