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

Allow to define sub-settings by module #6

Merged
merged 9 commits into from
Feb 9, 2017
Merged

Allow to define sub-settings by module #6

merged 9 commits into from
Feb 9, 2017

Conversation

tzi
Copy link
Collaborator

@tzi tzi commented Feb 6, 2017

There was a problem on how bemlinter linted multi-settings on single-website project:

  • In one side: we need to lint all the website stylesheets together, like a browser will use it
  • In the other side: we needed to use several bemlinter settings to assure the prefix presence, for example, in a specific folder/module

So I change the bemlinter behaviour to allow settings override in a specific module.

What changed:

  • [options] Creation of the file options, to get the linter options for a specific file path
  • [result] Every time we stock a reference of a block name, it's now a couple {moduleName, blockName}
  • [lint] Allow only one class prefix by module, to allow the linter to retrieve the module from a class name.
    Usage example: There is a style leak (a block styling another block) and we want to mark the external block as errored
  • [format] Group the result by module and display the module name before the block name
  • [documentation]
  • [test]

Extra:

  • A test for an invalid stylesheet

😞 Sorry for the fat PR, it is a big change for the bemlinter. There is certainly some improvment to do on the code readability...

@tzi tzi added the enhancement label Feb 6, 2017
Copy link
Member

@fdubost fdubost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code is OK for me. However the concept of "project" sounds strange for me. The project is the place where you want to use bemlinter. We want to apply different configs on project subsections. It's maybe "modules" rather than "projects", WYT ? It's just a naming observation 😺

sources: [`${__dirname}/sources/mixed-settings/project-prefixed.scss`],
classPrefix: 'c-',
filePattern: 'project-([^.]*)\.scss'
}]
}));
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh it seems there is no .editorconfig file in the project to tell your IDE to auto-add an empty line at the end of each file 😜

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Done!

@tzi
Copy link
Collaborator Author

tzi commented Feb 7, 2017

@fdubost 👍 The module name is way better.

@tzi
Copy link
Collaborator Author

tzi commented Feb 7, 2017

✅ Rename option to modules: done!

@tzi tzi changed the title Allow to override settings by project Allow to define sub-settings by module Feb 7, 2017
@tzi tzi merged commit e60d535 into master Feb 9, 2017
@tzi tzi deleted the project-options branch February 10, 2017 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants