diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3b8aa86..346585c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,12 +10,11 @@ jobs: fail-fast: false matrix: node-version: - - 16 - - 14 - - 12 + - 20 + - 18 steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - run: npm install diff --git a/index.js b/index.js index 5c37822..6ef3e50 100644 --- a/index.js +++ b/index.js @@ -1,12 +1,12 @@ -'use strict'; +import postcssScss from 'postcss-scss'; const reLowercase = /^[a-z]+(-[a-z\d]+)*$/; -module.exports = { +const config = { extends: 'stylelint-config-xo', - customSyntax: require('postcss-scss'), + customSyntax: postcssScss, plugins: [ - 'stylelint-scss' + 'stylelint-scss', ], rules: { 'at-rule-no-unknown': null, @@ -15,10 +15,11 @@ module.exports = { true, { ignoreAtRules: [ - 'use' - ] - } + 'use', + ], + }, ], + 'property-no-unknown': null, 'scss/at-each-key-value-single-line': true, 'scss/at-else-if-parentheses-space-before': 'always', @@ -26,15 +27,15 @@ module.exports = { 'scss/at-function-parentheses-space-before': 'never', 'scss/at-function-pattern': reLowercase, 'scss/at-if-no-null': true, - 'scss/at-import-no-partial-leading-underscore': true, 'scss/at-import-partial-extension': 'never', 'scss/at-mixin-argumentless-call-parentheses': 'never', 'scss/at-mixin-parentheses-space-before': 'never', 'scss/at-mixin-pattern': reLowercase, + 'scss/at-root-no-redundant': true, 'scss/at-rule-conditional-no-parentheses': true, 'scss/at-rule-no-unknown': true, 'scss/at-use-no-unnamespaced': true, - // Disabled because of https://github.com/kristerkari/stylelint-scss/issues/203 + // Disabled because of https://github.com/stylelint-scss/stylelint-scss/issues/172#issuecomment-363594714 // 'scss/dollar-variable-colon-newline-after': 'always-multi-line', 'scss/dollar-variable-colon-space-after': 'always-single-line', 'scss/dollar-variable-colon-space-before': 'never', @@ -56,6 +57,14 @@ module.exports = { 'scss/partial-no-import': true, 'scss/selector-no-redundant-nesting-selector': true, 'scss/no-duplicate-dollar-variables': true, - 'scss/no-duplicate-mixins': true - } + 'scss/no-duplicate-mixins': true, + 'scss/property-no-unknown': true, + 'scss/at-use-no-redundant-alias': true, + 'scss/function-calculation-no-interpolation': true, + 'scss/block-no-redundant-nesting': true, + 'scss/load-no-partial-leading-underscore': true, + 'scss/no-unused-private-members': true, + }, }; + +export default config; diff --git a/package.json b/package.json index 570eea9..fd8ff26 100644 --- a/package.json +++ b/package.json @@ -10,8 +10,11 @@ "email": "sindresorhus@gmail.com", "url": "https://sindresorhus.com" }, + "type": "module", + "exports": "./index.js", + "sideEffects": false, "engines": { - "node": ">=12" + "node": ">=18" }, "scripts": { "test": "xo && ava" @@ -31,16 +34,16 @@ "linter" ], "dependencies": { - "postcss-scss": "^4.0.3", - "stylelint-config-xo": "^0.21.0", - "stylelint-scss": "^4.2.0" + "postcss-scss": "^4.0.9", + "stylelint-config-xo": "^1.0.0", + "stylelint-scss": "^6.2.1" }, "devDependencies": { - "ava": "^2.4.0", - "stylelint": "^14.5.3", - "xo": "^0.32.0" + "ava": "^6.1.2", + "stylelint": "^16.4.0", + "xo": "^0.58.0" }, "peerDependencies": { - "stylelint": ">=14.5.1" + "stylelint": ">=16" } } diff --git a/test/test.js b/test/test.js index 3bbf7fe..7932268 100644 --- a/test/test.js +++ b/test/test.js @@ -1,21 +1,21 @@ import test from 'ava'; import stylelint from 'stylelint'; -import config from '..'; +import config from '../index.js'; const hasRule = (errors, ruleId) => errors.some(x => x.rule === ruleId); const runStylelint = async code => { const {results} = await stylelint.lint({ code, - config + config, }); for (const result of results) { - if (result.deprecations.length !== 0) { + if (result.deprecations.length > 0) { throw new Error(`Deprecations:\n${result.deprecations.join('\n')}`); } - if (result.invalidOptionWarnings.length !== 0) { + if (result.invalidOptionWarnings.length > 0) { const warnings = result.invalidOptionWarnings.map(x => x.text).join('\n'); throw new Error(`Invalid options:\n${warnings}`); } @@ -29,8 +29,8 @@ test('main', async t => { `div { left: .2em; } - ` + `, ); - t.true(hasRule(results[0].warnings, 'number-leading-zero')); + t.true(hasRule(results[0].warnings, '@stylistic/number-leading-zero')); });