npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@killusions/stylelint-config-scss

v1.5.3

Published

Configuration for Stylelint using SCSS (Sass).

Downloads

156

Readme

Fork of Siemens Lint

This is for testing purposes only.

Siemens Lint helps you to improve and keep the code quality of your project on a high level. It provides presets and plugins for various linters used at Siemens.

We welcome contributions of further linting rules and configs to be added to this repo for various other programming languages and frameworks.

Presets available for following linters:

Plugins:

Installation

Install *-config* and their peer dependencies in your project (whichever you need):

npm install stylelint-config-scss --save-dev --save-exact
npm install commitlint-config --save-dev --save-exact
npm install prettier-config --save-dev --save-exact
npm install eslint-config-typescript --save-dev --save-exact
npm install eslint-config-angular --save-dev --save-exact

Note You should specify the exact versions of the packages above and their peer dependencies like eslint and its plugins, stylelint, stylelint-config-sass-guidelines and @commitlint/config-conventional. Rules will get changed in the patch releases.

ESLint

TypeScript

Include the ESLint preset in your root eslint.config.mjs:

import path from 'path';
import { fileURLToPath } from 'url';
import typescriptEslint from 'typescript-eslint';
import typescriptConfig from 'eslint-config-typescript';

// mimic CommonJS variables
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

export default typescriptEslint.config({
  extends: [...baseTypescriptConfig, prettier],
  files: ['**/*.ts'],
  languageOptions: {
    parserOptions: {
      project: ['tsconfig.json', 'tsconfig.app.json', 'tsconfig.spec.json', 'e2e/tsconfig.json']
      tsconfigRootDir: __dirname
    }
  }
});

Note: to use less strict rules, use the base rules, by importing { configBase } instead.

Angular

Include the ESLint preset in your root eslint.config.js (not .mjs) and make sure "type": "module" is set in your root package.json:

import path from 'path';
import { fileURLToPath } from 'url';
import typescriptEslint from 'typescript-eslint';
import angularTypescriptConfig from 'eslint-config-angular';
import angularTemplateConfig from 'eslint-config-angular/template';

// mimic CommonJS variables
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

export const tsConfig = typescriptEslint.config({
  extends: [...angularTypescriptConfig, prettier],
  files: ['**/*.ts'],
  languageOptions: {
    parserOptions: {
      project: ['tsconfig.json', 'tsconfig.app.json', 'tsconfig.spec.json', 'e2e/tsconfig.json']
      tsconfigRootDir: __dirname
    }
  },
  rules: {
    '@angular-eslint/directive-selector': [
      'error',
      {
        type: 'attribute',
        prefix: 'app',
        style: 'camelCase'
      }
    ],
    '@angular-eslint/component-selector': [
      'error',
      {
        type: 'element',
        prefix: 'app',
        style: 'kebab-case'
      }
    ]
  }
});

export const templateConfig = typescriptEslint.config({
  extends: [...angularTemplateConfig, prettier],
  files: ['**/*.html']
});

export default typescriptEslint.config(...tsConfig, ...templateConfig);

For libraries and other things in the projects directory, make sure "type": "module" is set in the relevant package.json and create an additional eslint.config.js for each project that looks like this:

import typescriptEslint from 'typescript-eslint';
import { tsConfig, templateConfig } from '../../eslint.config.js';

export default typescriptEslint.config(
  {
    extends: [...tsConfig],
    files: ['**/*.ts'],
    languageOptions: {
      parserOptions: {
        project: ['projects/element-ng/tsconfig.lib.json', 'projects/element-ng/tsconfig.spec.json']
      }
    },
    rules: {
      '@angular-eslint/component-selector': [
        'error',
        {
          type: 'element',
          prefix: 'si',
          style: 'kebab-case'
        }
      ],
      '@angular-eslint/directive-selector': [
        'error',
        {
          type: 'attribute',
          prefix: 'si',
          style: 'camelCase'
        }
      ]
    }
  },
  ...templateConfig
);

The @angular-eslint/builder will also not automatically pick up the library config location, manually provide it in angular.json:

@@ -122,15 +125,11 @@
          }
        },
        "lint": {
          "builder": "@angular-eslint/builder:lint",
          "options": {
            "lintFilePatterns": [
              "src/**/*.ts",
              "src/**/*.html"
            ],
+           "eslintConfig": "path/to/project/eslint.config.js"
          }
        },

Migration from TSLint

Also in angular.json, make sure to replace the TSLint related entries like this:

@@ -122,15 +125,11 @@
          }
        },
        "lint": {
-         "builder": "@angular-devkit/build-angular:tslint",
+         "builder": "@angular-eslint/builder:lint",
          "options": {
-           "tsConfig": [
-             "tsconfig.app.json",
-             "tsconfig.spec.json",
-             "e2e/tsconfig.json"
-           ],
-           "exclude": [
-             "**/node_modules/**"
+           "lintFilePatterns": [
+             "src/**/*.ts",
+             "src/**/*.html"
            ]
          }
        },

Note: to use less strict rules, which are derived from the upstream Angular recommendation and more geared towards applications, use the base rules, by importing { configBase } instead.

Stylelint

Include the stylelint preset in your .stylelintrc.yml:

extends:
  - 'stylelint-config-scss/stylelintrc.yml'

Commitlint

Include the commitlint preset in your package.json:

  "commitlint": {
    "extends": [
      "commitlint-config/.commitlintrc.js"
    ]
  },

// Optional: Pre-commit hook using husky: https://github.com/typicode/husky
  "husky": {
      "hooks": {
        "commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
      }
    },

Prettier

Include the shared Prettier config in your package.json:

"prettier": "prettier-config/.prettierrc.json",

ESLint Plugin

The usage of the ESLint plugin is documented here.

Usage

The preset will now be automatically used by eslint and ng lint. Please refer to the Angular ESLint and ng lint documentation for more details.

Add the commitlint, ESlint and stylelint scripts to your package.json:

"scripts": {
  "lint": "ng lint",
  "lint:sass": "stylelint **.scss",
  "lint:commit": "commitlint --from=origin/main",
  "lint:all": "npm run lint:commit && npm run lint && npm run lint:sass"
}

To fix ESLint issues automatically use:

"scripts": {
  "lint:fix": "ng lint --fix"
}

To fix stylelint issues automatically use:

"scripts": {
  "lint:sass:fix": "stylelint --fix **.scss"
}

Make sure to call the linters in your CI build chain in .gitlab-ci.yml:

lint:
  stage: tests
  script:
    - npm install
    - npm run lint:all

Note: To make commitlint work in Gitlab CI, one needs to set the Git shallow clone setting to 0 (found in project settings > CI / CD). That way GitLab CI fetches all branches and tags each time.

Contributing

Improvements are always welcome! Feel free to log a bug, write a suggestion or contribute code by creating a pull request. All details are listed in our contribution guide.

See CONTRIBUTING.md.

License

Code and documentation Copyright (c) Siemens 2018 - 2024.

See LICENSE.md.