Skip to content
This repository has been archived by the owner on Sep 30, 2020. It is now read-only.

Lint for inappropriate use of SCSS/CSS import return values #122

Closed
wincent opened this issue Nov 27, 2019 · 0 comments · Fixed by #133
Closed

Lint for inappropriate use of SCSS/CSS import return values #122

wincent opened this issue Nov 27, 2019 · 0 comments · Fixed by #133
Assignees
Labels

Comments

@wincent
Copy link
Contributor

wincent commented Nov 27, 2019

These should only ever be imported for their side-effects:

import './My.scss';

Never assigned:

import bad from './My.scss';
@wincent wincent self-assigned this Jan 20, 2020
wincent added a commit that referenced this issue Jan 20, 2020
This rule prevents us from providing useless import specifiers when
importing SCSS via the loader:

    import useless from './styles.scss';

These modules should only be imported for their side-effects; ie:

    import './styles.scss';

As noted in the docs, we might want to lint for other kinds of non-JS
resources in the future, but for now ".scss" is the only file type that
we actually have configured to load via this mechanism.

Test plan: Copy the code over to a liferay-portal repo (eg.
with `cp -R ~/code/eslint-config-liferay/{portal.js,plugins}
node_modules/eslint-config-liferay`) and then introduce a fake error;
see this in the lint run output (`yarn checkFormat`):

    modules/apps/frontend-js/frontend-js-components-web/src/main/resources/META-INF/resources/treeview/Treeview.js
      24:1  error  SCSS resources should be imported only for side-effects  liferay-portal/no-loader-import-specifier

Closes: #122
wincent added a commit that referenced this issue Jan 20, 2020
feat!: add no-loader-import-specifier rule (#122)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant