Skip to content
This repository has been archived by the owner on Jul 12, 2019. It is now read-only.

Commit

Permalink
feat(stylelint-config-elements): add stylelint (#333)
Browse files Browse the repository at this point in the history
* chore(project): sync offline mirror

* feat(stylelint-config-elements): add stylelint

* chore(project): add copyright banners
  • Loading branch information
joshblack authored Feb 8, 2019
1 parent d3ef8f6 commit 94df4a2
Show file tree
Hide file tree
Showing 101 changed files with 1,152 additions and 359 deletions.
8 changes: 8 additions & 0 deletions .stylelintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
**/build/**
**/dist/**
**/examples/**

# Generated SCSS directories and files
**/packages/colors/**/*.scss
**/packages/elements/scss/**/*.scss
**/packages/themes/**/*.scss
Binary file removed .yarn-offline-mirror/@babel-core-7.0.0-rc.1.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/@babel-core-7.2.2.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/@babel-generator-7.0.0-rc.1.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/@babel-generator-7.3.2.tgz
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn-offline-mirror/@babel-helpers-7.0.0-rc.1.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/@babel-parser-7.0.0-rc.1.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/@babel-parser-7.3.2.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/@babel-template-7.0.0-rc.1.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/@babel-template-7.2.2.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/@babel-traverse-7.0.0-rc.1.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/@babel-traverse-7.2.3.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/@babel-types-7.0.0-rc.1.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/@babel-types-7.3.2.tgz
Binary file not shown.
Binary file not shown.
Binary file removed .yarn-offline-mirror/@nodelib-fs.stat-1.1.0.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/@nodelib-fs.stat-1.1.3.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/ajv-6.8.1.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/ansi-regex-4.0.0.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/chalk-2.4.2.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/debug-4.1.1.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/dir-glob-2.0.0.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/dir-glob-2.2.2.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/emoji-regex-7.0.3.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/fast-diff-1.2.0.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/fast-glob-2.2.2.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/fast-glob-2.2.6.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/file-entry-cache-4.0.0.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/flat-cache-2.0.1.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/flatted-2.0.0.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/global-modules-2.0.0.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/global-prefix-3.0.0.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/globby-8.0.1.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/globby-9.0.0.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/htmlparser2-3.10.0.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/ignore-3.3.10.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/ignore-5.0.5.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/js-base64-2.4.8.tgz
Binary file not shown.
Binary file not shown.
Binary file removed .yarn-offline-mirror/known-css-properties-0.6.1.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/lodash-4.17.11.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/merge2-1.2.2.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/merge2-1.2.3.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/pify-4.0.1.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/postcss-5.2.18.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/postcss-6.0.22.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/postcss-6.0.23.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/postcss-7.0.14.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/postcss-html-0.33.0.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/postcss-html-0.36.0.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/postcss-jsx-0.33.0.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/postcss-jsx-0.36.0.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/postcss-less-2.0.0.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/postcss-less-3.1.2.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/postcss-markdown-0.33.0.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/postcss-markdown-0.36.0.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/postcss-reporter-5.0.0.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/postcss-reporter-6.0.1.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/postcss-sass-0.3.2.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/postcss-sass-0.3.5.tgz
Binary file not shown.
Binary file not shown.
Binary file removed .yarn-offline-mirror/postcss-styled-0.33.0.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/postcss-syntax-0.33.0.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/postcss-syntax-0.36.2.tgz
Binary file not shown.
Binary file not shown.
Binary file added .yarn-offline-mirror/readable-stream-3.1.1.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/remark-9.0.0.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/remark-parse-5.0.0.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/remark-stringify-5.0.0.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/slice-ansi-2.1.0.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/specificity-0.4.0.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/specificity-0.4.1.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/string-width-3.0.0.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/string_decoder-1.2.0.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/strip-ansi-5.0.0.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/stylelint-9.10.1.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/stylelint-9.5.0.tgz
Binary file not shown.
Binary file not shown.
Binary file added .yarn-offline-mirror/stylelint-prettier-1.0.6.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/stylelint-scss-3.5.3.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/supports-color-6.1.0.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/table-5.2.2.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/unified-6.2.0.tgz
Binary file not shown.
Binary file removed .yarn-offline-mirror/vfile-2.3.0.tgz
Binary file not shown.
Binary file added .yarn-offline-mirror/write-1.0.3.tgz
Binary file not shown.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"format:diff": "prettier --list-different '**/*.{css,js,md,scss,ts}' '!**/{build,es,lib,storybook,ts,umd}/**'",
"format:staged": "prettier --write",
"lint": "toolkit lint .",
"lint:styles": "toolkit stylelint \"**/*.{css,scss}\"",
"lint:styles": "stylelint \"**/*.{css,scss}\" --config ./packages/stylelint-config-elements",
"sync": "node tasks/sync.js",
"test": "jest",
"test:e2e": "jest --testPathPattern=e2e --testPathIgnorePatterns=examples"
Expand All @@ -37,7 +37,6 @@
"@carbon/cli-plugin-editorconfig": "^0.0.23",
"@carbon/cli-plugin-eslint": "^0.0.23",
"@carbon/cli-plugin-github-files": "^0.0.23",
"@carbon/cli-plugin-stylelint": "^0.0.23",
"@carbon/toolkit": "^0.0.23",
"@commitlint/cli": "^7.2.1",
"@commitlint/config-conventional": "^7.1.2",
Expand All @@ -60,12 +59,12 @@
"prettier": "^1.15.2",
"remark": "^10.0.1",
"remark-word-wrap": "^2.0.2",
"rimraf": "^2.6.2"
"rimraf": "^2.6.2",
"stylelint": "^9.10.1"
},
"toolkit": {
"plugins": [
"@carbon/cli-plugin-eslint",
"@carbon/cli-plugin-stylelint",
"@carbon/cli-plugin-github-files",
"@carbon/cli-plugin-editorconfig"
]
Expand All @@ -88,6 +87,7 @@
],
"*.{scss,css}": [
"yarn format:staged",
"yarn lint:styles",
"git add"
],
"*.md": [
Expand Down
1 change: 1 addition & 0 deletions packages/grid/scss/_container.scss
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
// gets the last breakpoint width, and sets it to a max-width
@mixin carbon--set-largest-breakpoint($breakpoints: $carbon--grid-breakpoints) {
$largest-breakpoint: last-map-item($breakpoints);

max-width: map-get($largest-breakpoint, 'width');
}

Expand Down
8 changes: 4 additions & 4 deletions packages/grid/scss/grid.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
.#{$prefix}--grid {
@include carbon--make-container();
@include carbon--make-container-max-widths();
}

&--full-width {
@include carbon--largest-breakpoint() {
max-width: 100%;
}
.#{$prefix}--grid--full-width {
@include carbon--largest-breakpoint() {
max-width: 100%;
}
}

Expand Down
4 changes: 4 additions & 0 deletions packages/stylelint-config-elements/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
**/__mocks__/**
**/__tests__/**
**/examples/**
**/tasks/**
18 changes: 18 additions & 0 deletions packages/stylelint-config-elements/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* Copyright IBM Corp. 2018, 2018
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/

'use strict';

module.exports = {
extends: [
require.resolve('./rules/possible-errors'),
require.resolve('./rules/limit-language-features'),
require.resolve('./rules/stylistic-issues'),
require.resolve('./plugins/prettier'),
require.resolve('./plugins/scss'),
],
};
31 changes: 31 additions & 0 deletions packages/stylelint-config-elements/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "@carbon/stylelint-config-elements",
"private": true,
"description": "Stylelint configuration for Carbon Elements",
"version": "0.0.1-alpha.31",
"license": "Apache-2.0",
"main": "index.js",
"repository": "https://github.com/IBM/carbon-elements/tree/master/packages/stylelint-config-elements",
"bugs": "https://github.com/IBM/carbon-elements/issues",
"keywords": [
"ibm",
"elements",
"carbon",
"carbon-elements",
"carbon-design-system"
],
"publishConfig": {
"access": "public"
},
"peerDependencies": {
"stylelint": "^9.10.1"
},
"dependencies": {
"stylelint-config-prettier": "^4.0.0",
"stylelint-prettier": "^1.0.6",
"stylelint-scss": "^3.5.3"
},
"devDependencies": {
"stylelint": "^9.10.1"
}
}
16 changes: 16 additions & 0 deletions packages/stylelint-config-elements/plugins/prettier.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* Copyright IBM Corp. 2018, 2018
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/

'use strict';

module.exports = {
extends: ['stylelint-config-prettier'],
plugins: ['stylelint-prettier'],
rules: {
'prettier/prettier': true,
},
};
119 changes: 119 additions & 0 deletions packages/stylelint-config-elements/plugins/scss.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
/**
* Copyright IBM Corp. 2018, 2018
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/

'use strict';

const OFF = null;

module.exports = {
plugins: ['stylelint-scss'],
rules: {
// @-else
// Require or disallow a newline after the closing brace of @else statements.
'scss/at-else-closing-brace-newline-after': 'always-last-in-chain',
// Require a single space or disallow whitespace after the closing brace of @else statements.
'scss/at-else-closing-brace-space-after': 'always-intermediate',
// Require an empty line or disallow empty lines before @-else.
'scss/at-else-empty-line-before': 'never',
// Require or disallow a space before @else if parentheses.
'scss/at-else-if-parentheses-space-before': OFF,

// @-extend
// Disallow at-extends (@extend) with missing placeholders.
'scss/at-extend-no-missing-placeholder': OFF,

// @-function
// Require named parameters in SCSS function call rule.
'scss/at-function-named-arguments': OFF,
// Require or disallow a space before @function parentheses.
'scss/at-function-parentheses-space-before': OFF,
// Specify a pattern for Sass/SCSS-like function names.
'scss/at-function-pattern': OFF,

// @-if
// Require or disallow a newline after the closing brace of @if statements.
'scss/at-if-closing-brace-newline-after': OFF,
// Require a single space or disallow whitespace after the closing brace of @if statements.
'scss/at-if-closing-brace-space-after': OFF,

// @-import
// Disallow leading underscore in partial names in @import.
'scss/at-import-no-partial-leading-underscore': OFF,
// Specify blacklist of disallowed file extensions for partial names in @import commands.
'scss/at-import-partial-extension-blacklist': OFF,
// Specify whitelist of allowed file extensions for partial names in @import commands.
'scss/at-import-partial-extension-whitelist': OFF,

// @-mixin
// Require or disallow parentheses in argumentless @mixin calls.
'scss/at-mixin-argumentless-call-parentheses': OFF,
// Require named parameters in at-mixin call rule.
'scss/at-mixin-named-arguments': OFF,
// Require or disallow a space before @mixin parentheses.
'scss/at-mixin-parentheses-space-before': OFF,
// Specify a pattern for Sass/SCSS-like mixin names.
'scss/at-mixin-pattern': OFF,

// @-rule
// Disallow unknown at-rules. Should be used instead of stylelint's at-rule-no-unknown.
'scss/at-rule-no-unknown': true,

// $-variable
// Require a newline after the colon in $-variable declarations.
'scss/dollar-variable-colon-newline-after': OFF,
// Require a single space or disallow whitespace after the colon in $-variable declarations.
'scss/dollar-variable-colon-space-after': OFF,
// Require a single space or disallow whitespace before the colon in $-variable declarations.
'scss/dollar-variable-colon-space-before': OFF,
// Require !default flag for $-variable declarations.
'scss/dollar-variable-default': OFF,
// Require a single empty line or disallow empty lines before $-variable declarations.
'scss/dollar-variable-empty-line-before': OFF,
// Disallow Sass variables that are used without interpolation with CSS features that use custom identifiers.
'scss/dollar-variable-no-missing-interpolation': true,
// Specify a pattern for Sass-like variables.
'scss/dollar-variable-pattern': OFF,

// %-placeholder
// Specify a pattern for %-placeholders.
'scss/percent-placeholder-pattern': OFF,

// //-comment
// Require or disallow an empty line before //-comments.
'scss/double-slash-comment-empty-line-before': OFF,
// Require or disallow //-comments to be inline comments.
'scss/double-slash-comment-inline': 'never',
// Require or disallow whitespace after the // in //-comments
'scss/double-slash-comment-whitespace-inside': OFF,

// Declaration
// Require or disallow properties with - in their names to be in a form of a nested group.
'scss/declaration-nested-properties': 'never',
// Disallow nested properties of the same "namespace" be divided into multiple groups.
'scss/declaration-nested-properties-no-divided-groups': OFF,

// Media feature
// Require a media feature value be a $-variable or disallow $-variables in media feature values.
'scss/media-feature-value-dollar-variable': OFF,

// Operator
// Disallow linebreaks after Sass operators.
'scss/operator-no-newline-after': OFF,
// Disallow linebreaks before Sass operators.
'scss/operator-no-newline-before': true,
// Disallow unspaced operators in Sass operations.
'scss/operator-no-unspaced': true,

// Partial
// Disallow non-CSS @imports in partial files.
'scss/partial-no-import': OFF,

// Selector
// Disallow redundant nesting selectors (&).
'scss/selector-no-redundant-nesting-selector': true,
},
};
Loading

0 comments on commit 94df4a2

Please sign in to comment.