diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..0f17867 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 2 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..cff2e94 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "standardpress" +} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d5f19d8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +node_modules +package-lock.json diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..c1ca392 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +package-lock = false diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..210f9d9 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,25 @@ +language: node_js +node_js: + - "11" + - "10" + - "9" + - "8" + - "7" + - "6" +cache: npm +before_install: + - nvm install-latest-npm +script: + - npm run lint + - npm test +jobs: + include: + - stage: deploying to npm + node_js: "11" + script: echo "Deploying to npm ..." + deploy: + provider: npm + email: $NPM_EMAIL + api_key: $NPM_API_KEY + on: + branch: master diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..fd56020 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,10 @@ +# Changelog +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## 0.1.0 - 2019-03-24 +### Added +- stylelint css shareable config. +- stylelint scss shareable config. diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..314545f --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Jason Nam + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..aefa5a0 --- /dev/null +++ b/README.md @@ -0,0 +1,57 @@ +# stylelint-config-standardpress + +[![npm version](https://img.shields.io/npm/v/stylelint-config-standardpress.svg)](https://npmjs.com/package/stylelint-config-standardpress) +[![travis-ci build status](https://travis-ci.com/standardpress/stylelint-config-standardpress.svg?branch=master)](https://travis-ci.com/standardpress/stylelint-config-standardpress) +[![appveyor build status](https://ci.appveyor.com/api/projects/status/ygxptjl6u9450761/branch/master?svg=true)](https://ci.appveyor.com/project/jasonnam/stylelint-config-standardpress/branch/master) + +stylelint shareable config by StandardPress. + +## Installation + +### install-peerdeps + +Install with [`install-peerdeps`](https://npmjs.com/package/install-peerdeps): + +```sh +npx install-peerdeps --dev stylelint-config-standardpress +``` + +### npm + +Install with npm: + +```sh +npm install --save-dev stylelint-config-standardpress +``` + +Next, install the correct versions of each package, which are listed by the command: + +```sh +npm info "stylelint-config-standardpress@latest" peerDependencies +``` + +## Usage + +### CSS + +Extend stylelint config with `stylelint-config-standardpress/css`. + +```json +{ + "extends": "stylelint-config-standardpress/css" +} +``` + +### Sass + +Extend stylelint config with `stylelint-config-standardpress/scss`. + +```json +{ + "extends": "stylelint-config-standardpress/scss" +} +``` + +## License + +stylelint-config-standardpress is released under the MIT license. [See LICENSE](https://github.com/standardpress/stylelint-config-standardpress/blob/master/LICENSE) for details. diff --git a/__tests__/index.test.js b/__tests__/index.test.js new file mode 100644 index 0000000..11f1169 --- /dev/null +++ b/__tests__/index.test.js @@ -0,0 +1,30 @@ +'use strict'; + +const stylelint = require('stylelint'); + +test('all css rules are configured correctly', () => { + const config = require('../css'); + + return stylelint.lint({ + code: 'a { font-weight: bold; }', + config + }).then(data => { + expect(data.results.length).toBeGreaterThan(0); + expect(data.results[0].invalidOptionWarnings).toHaveLength(0); + expect(data.results[0].deprecations).toHaveLength(0); + }); +}); + +test('all scss rules are configured correctly', () => { + const config = require('../scss'); + + return stylelint.lint({ + code: 'a { font-weight: bold; }', + configBasedir: __dirname, + config + }).then(data => { + expect(data.results.length).toBeGreaterThan(0); + expect(data.results[0].invalidOptionWarnings).toHaveLength(0); + expect(data.results[0].deprecations).toHaveLength(0); + }); +}); diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..72ceb3d --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,24 @@ +environment: + matrix: + - nodejs_version: "6" + - nodejs_version: "7" + - nodejs_version: "8" + - nodejs_version: "9" + - nodejs_version: "10" + - nodejs_version: "11" +platform: + - x86 + - x64 +cache: + - node_modules +install: + - ps: Install-Product node $env:nodejs_version $env:platform + - npm install npm --global + - npm install +build: off +test_script: + - node --version + - npm --version + - npm run lint + - npm test +deploy: off diff --git a/css/index.js b/css/index.js new file mode 100644 index 0000000..72081e1 --- /dev/null +++ b/css/index.js @@ -0,0 +1,257 @@ +'use strict'; + +module.exports = { + 'extends': 'stylelint-config-standard', + 'plugins': [ + 'stylelint-order' + ], + 'rules': { + 'at-rule-name-space-after': 'always', + 'at-rule-no-vendor-prefix': true, + 'at-rule-semicolon-space-before': 'never', + 'color-named': 'never', + 'declaration-block-semicolon-newline-before': 'never-multi-line', + 'declaration-empty-line-before': null, + 'declaration-no-important': true, + 'font-family-name-quotes': 'always-where-recommended', + 'font-weight-notation': [ + 'numeric', + { + 'ignore': [ + 'relative' + ] + } + ], + 'function-url-no-scheme-relative': true, + 'function-url-quotes': 'always', + 'length-zero-no-unit': true, + 'media-feature-name-no-vendor-prefix': true, + 'number-leading-zero': 'never', + 'order/properties-order': [ + 'position', + 'top', + 'right', + 'bottom', + 'left', + 'z-index', + 'box-sizing', + 'display', + 'flex', + 'flex-align', + 'flex-basis', + 'flex-direction', + 'flex-wrap', + 'flex-flow', + 'flex-shrink', + 'flex-grow', + 'flex-order', + 'flex-pack', + 'align-content', + 'align-items', + 'align-self', + 'justify-content', + 'order', + 'float', + 'width', + 'min-width', + 'max-width', + 'height', + 'min-height', + 'max-height', + 'padding', + 'padding-top', + 'padding-right', + 'padding-bottom', + 'padding-left', + 'margin', + 'margin-top', + 'margin-right', + 'margin-bottom', + 'margin-left', + 'overflow', + 'overflow-x', + 'overflow-y', + '-webkit-overflow-scrolling', + '-ms-overflow-x', + '-ms-overflow-y', + '-ms-overflow-style', + 'columns', + 'column-count', + 'column-fill', + 'column-gap', + 'column-rule', + 'column-rule-width', + 'column-rule-style', + 'column-rule-color', + 'column-span', + 'column-width', + 'orphans', + 'widows', + 'clip', + 'clear', + 'font', + 'font-family', + 'font-size', + 'font-style', + 'font-weight', + 'font-variant', + 'font-size-adjust', + 'font-stretch', + 'font-effect', + 'font-emphasize', + 'font-emphasize-position', + 'font-emphasize-style', + 'font-smooth', + 'src', + 'hyphens', + 'line-height', + 'color', + 'text-align', + 'text-align-last', + 'text-emphasis', + 'text-emphasis-color', + 'text-emphasis-style', + 'text-emphasis-position', + 'text-decoration', + 'text-indent', + 'text-justify', + 'text-outline', + '-ms-text-overflow', + 'text-overflow', + 'text-overflow-ellipsis', + 'text-overflow-mode', + 'text-shadow', + 'text-transform', + 'text-wrap', + '-webkit-text-size-adjust', + '-ms-text-size-adjust', + 'letter-spacing', + '-ms-word-break', + 'word-break', + 'word-spacing', + '-ms-word-wrap', + 'word-wrap', + 'overflow-wrap', + 'tab-size', + 'white-space', + 'vertical-align', + 'direction', + 'unicode-bidi', + 'list-style', + 'list-style-position', + 'list-style-type', + 'list-style-image', + 'pointer-events', + '-ms-touch-action', + 'touch-action', + 'cursor', + 'visibility', + 'zoom', + 'table-layout', + 'empty-cells', + 'caption-side', + 'border-spacing', + 'border-collapse', + 'content', + 'quotes', + 'counter-reset', + 'counter-increment', + 'resize', + 'user-select', + 'nav-index', + 'nav-up', + 'nav-right', + 'nav-down', + 'nav-left', + 'background', + 'background-color', + 'background-image', + 'filter', + 'background-repeat', + 'background-attachment', + 'background-position', + 'background-position-x', + 'background-position-y', + 'background-clip', + 'background-origin', + 'background-size', + 'border', + 'border-color', + 'border-style', + 'border-width', + 'border-top', + 'border-top-color', + 'border-top-style', + 'border-top-width', + 'border-right', + 'border-right-color', + 'border-right-style', + 'border-right-width', + 'border-bottom', + 'border-bottom-color', + 'border-bottom-style', + 'border-bottom-width', + 'border-left', + 'border-left-color', + 'border-left-style', + 'border-left-width', + 'border-radius', + 'border-top-left-radius', + 'border-top-right-radius', + 'border-bottom-right-radius', + 'border-bottom-left-radius', + 'border-image', + 'border-image-source', + 'border-image-slice', + 'border-image-width', + 'border-image-outset', + 'border-image-repeat', + 'outline', + 'outline-width', + 'outline-style', + 'outline-color', + 'outline-offset', + 'box-shadow', + 'opacity', + '-ms-interpolation-mode', + 'page-break-after', + 'page-break-before', + 'page-break-inside', + 'transition', + 'transition-delay', + 'transition-timing-function', + 'transition-duration', + 'transition-property', + 'transform', + 'transform-origin', + 'perspective', + 'appearance', + 'animation', + 'animation-name', + 'animation-duration', + 'animation-play-state', + 'animation-timing-function', + 'animation-delay', + 'animation-iteration-count', + 'animation-direction', + 'animation-fill-mode', + 'fill', + 'stroke' + ], + 'property-no-vendor-prefix': true, + 'selector-attribute-quotes': 'always', + 'selector-list-comma-newline-after': 'always', + 'selector-list-comma-newline-before': 'never-multi-line', + 'selector-list-comma-space-after': 'always-single-line', + 'selector-list-comma-space-before': 'never-single-line', + 'selector-no-qualifying-type': true, + 'selector-no-vendor-prefix': true, + 'shorthand-property-no-redundant-values': true, + 'string-quotes': 'double', + 'value-keyword-case': 'lower', + 'value-list-comma-newline-after': 'never-multi-line', + 'value-list-comma-newline-before': 'never-multi-line', + 'value-list-comma-space-after': 'always', + 'value-no-vendor-prefix': true + } +}; diff --git a/package.json b/package.json new file mode 100644 index 0000000..7a258a7 --- /dev/null +++ b/package.json @@ -0,0 +1,52 @@ +{ + "name": "stylelint-config-standardpress", + "description": "stylelint shareable config by StandardPress.", + "license": "MIT", + "author": "Jason Nam (https://jasonnam.com)", + "homepage": "https://github.com/standardpress/stylelint-config-standardpress", + "repository": { + "type": "git", + "url": "https://github.com/standardpress/stylelint-config-standardpress" + }, + "bugs": { + "url": "https://github.com/standardpress/stylelint-config-standardpress/issues" + }, + "version": "0.1.0", + "main": "css/index.js", + "files": [ + "scss/index.js" + ], + "scripts": { + "lint": "eslint css scss __tests__", + "test": "jest" + }, + "peerDependencies": { + "stylelint": "^9.10.1", + "stylelint-config-standard": "^18.2.0", + "stylelint-order": "^2.1.0", + "stylelint-scss": "^3.5.4" + }, + "devDependencies": { + "eslint": "^5.15.3", + "eslint-config-standardpress": "^0.1.0", + "eslint-plugin-eslint-comments": "^3.1.1", + "eslint-plugin-jest": "^22.4.1", + "eslint-plugin-node": "^8.0.1", + "eslint-plugin-sort-requires": "^2.1.0", + "jest": "^24.5.0", + "stylelint": "^9.10.1", + "stylelint-config-standard": "^18.2.0", + "stylelint-order": "^2.1.0", + "stylelint-scss": "^3.5.4" + }, + "keywords": [ + "config", + "lint", + "standardpress", + "stylelint", + "stylelint-config" + ], + "engines": { + "node": ">=6" + } +} diff --git a/scss/index.js b/scss/index.js new file mode 100644 index 0000000..b616c97 --- /dev/null +++ b/scss/index.js @@ -0,0 +1,32 @@ +'use strict'; + +module.exports = { + 'extends': '../css', + 'plugins': [ + 'stylelint-scss' + ], + 'rules': { + 'at-rule-empty-line-before': null, + 'at-rule-no-unknown': null, + 'scss/at-extend-no-missing-placeholder': true, + 'scss/at-function-parentheses-space-before': 'never', + 'scss/at-import-no-partial-leading-underscore': true, + 'scss/at-mixin-argumentless-call-parentheses': 'always', + 'scss/at-mixin-parentheses-space-before': 'never', + 'scss/at-rule-no-unknown': true, + 'scss/dollar-variable-colon-space-after': 'always-single-line', + 'scss/dollar-variable-colon-space-before': 'never', + 'scss/dollar-variable-default': [ + true, + { + 'ignore': 'local' + } + ], + 'scss/dollar-variable-no-missing-interpolation': true, + 'scss/operator-no-newline-after': true, + 'scss/operator-no-newline-before': true, + 'scss/operator-no-unspaced': true, + 'scss/partial-no-import': true, + 'scss/selector-no-redundant-nesting-selector': true + } +};