diff --git a/.eslintrc b/.eslintrc index c6fb3d4..a0a1aef 100644 --- a/.eslintrc +++ b/.eslintrc @@ -6,7 +6,6 @@ ], "rules": { - "@typescript-eslint/ban-ts-comment": "warn", - "unicorn/prefer-at": "warn" + "@typescript-eslint/ban-ts-comment": "warn" } } diff --git a/.mocharc.json b/.mocharc.json index e8d9cab..681c82a 100644 --- a/.mocharc.json +++ b/.mocharc.json @@ -5,8 +5,8 @@ ], "node-option": [ - "experimental-specifier-resolution=node", - "loader=ts-node/esm" + "experimental-specifier-resolution node", + "loader ts-node/esm" ], "spec": "tests/**/*.spec.ts" } diff --git a/package.json b/package.json index b035617..775be33 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,9 @@ { "name": "@isnotdefined/stylelint-plugin", "description": "Yet another Stylelint plugin", - "version": "3.1.0", + "version": "4.0.0-beta.1", "license": "MIT", + "type": "module", "keywords": [ "stylelint", @@ -32,30 +33,30 @@ }, "peerDependencies": { - "stylelint": "^15" + "stylelint": "^16" }, "devDependencies": { - "@isnotdefined/eslint-config": "8.1.0", + "@isnotdefined/eslint-config": "9.8.0", "@types/chai": "4.3.11", "@types/mocha": "10.0.6", - "@types/node": "20.10.0", - "@types/postcss-plugins": "1.13.0", - "chai": "4.3.7", - "eslint": "8.34.0", + "@types/node": "20.10.4", + "@types/postcss-plugins": "1.13.2", + "chai": "4.3.10", + "eslint": "8.55.0", "mocha": "10.2.0", - "rollup": "2.79.1", - "rollup-plugin-copy": "3.4.0", + "rollup": "4.8.0", + "rollup-plugin-copy": "3.5.0", "rollup-plugin-delete": "2.0.0", - "rollup-plugin-ts": "3.1.1", - "stylelint": "15.11.0", - "ts-node": "10.9.1", - "typescript": "4.9.5" + "rollup-plugin-ts": "3.4.5", + "stylelint": "16.0.2", + "ts-node": "10.9.2", + "typescript": "5.3.3" }, "scripts": { - "build": "rollup --config=rollup.config.js", - "lint": "eslint src tests --ext=.ts", + "build": "rollup --config rollup.config.js", + "lint": "eslint src tests --ext .ts", "fix": "npm run lint -- --fix", "test": "mocha" }, diff --git a/rollup.config.js b/rollup.config.js index 99dabad..95feb3f 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -1,7 +1,7 @@ import del from 'rollup-plugin-delete'; import ts from 'rollup-plugin-ts'; import copy from 'rollup-plugin-copy'; -import PACKAGE from './package.json'; +import PACKAGE from './package.json' assert { type: 'json' }; export default { diff --git a/src/rules/no-disable/rule.ts b/src/rules/no-disable/rule.ts index 888278b..ccae578 100644 --- a/src/rules/no-disable/rule.ts +++ b/src/rules/no-disable/rule.ts @@ -1,8 +1,10 @@ import { Root } from 'postcss'; import stylelint, { Rule, PostcssResult } from 'stylelint'; + +import { wording } from '../wording'; + import { defaultOptions } from './option'; import { Options } from './option.interface'; -import { wording } from '../wording'; const { utils, createPlugin } : typeof stylelint = stylelint; const ruleName : string = '@isnotdefined/no-disable'; @@ -30,7 +32,7 @@ function rule(primaryOptions : Options) { root.walkComments(comment => { - if (options.commands.includes(comment.text.split(' ')[0])) + if (options.commands.includes(comment.text.split(' ').at(0))) { utils.report( { diff --git a/src/rules/no-obsolete/rule.ts b/src/rules/no-obsolete/rule.ts index a9777db..6a4bb6c 100644 --- a/src/rules/no-obsolete/rule.ts +++ b/src/rules/no-obsolete/rule.ts @@ -1,8 +1,10 @@ import { Root } from 'postcss'; import stylelint, { Rule, RuleContext, PostcssResult } from 'stylelint'; + +import { wording } from '../wording'; + import { defaultOptions } from './option'; import { Options, AtRule, Property } from './option.interface'; -import { wording } from '../wording'; const { utils, createPlugin } : typeof stylelint = stylelint; const ruleName : string = '@isnotdefined/no-obsolete'; diff --git a/src/rules/unit-step/rule.ts b/src/rules/unit-step/rule.ts index 2ec28f4..1b58df8 100644 --- a/src/rules/unit-step/rule.ts +++ b/src/rules/unit-step/rule.ts @@ -1,9 +1,11 @@ import { Root } from 'postcss'; import { ContainerBase, parse } from 'postcss-values-parser'; import stylelint, { Rule, RuleContext, PostcssResult } from 'stylelint'; + +import { wording } from '../wording'; + import { defaultOptions } from './option'; import { Options } from './option.interface'; -import { wording } from '../wording'; const { utils, createPlugin } : typeof stylelint = stylelint; const ruleName : string = '@isnotdefined/unit-step'; diff --git a/tests/no-disable.spec.ts b/tests/no-disable.spec.ts index 8ce6af1..70a18d0 100644 --- a/tests/no-disable.spec.ts +++ b/tests/no-disable.spec.ts @@ -31,7 +31,7 @@ describe('no-disable', () => } }); - expect(linterResult.results[0]._postcssResult.messages[index].text).to.equal(message); + expect(linterResult.results.at(0)._postcssResult.messages[index].text).to.equal(message); }); }); }); diff --git a/tests/no-obsolete.spec.ts b/tests/no-obsolete.spec.ts index 8e297eb..760bd4e 100644 --- a/tests/no-obsolete.spec.ts +++ b/tests/no-obsolete.spec.ts @@ -1,5 +1,6 @@ import { expect } from 'chai'; import stylelint, { LinterResult } from 'stylelint'; + const { lint } : typeof stylelint = stylelint; describe('no-obsolete', () => @@ -59,7 +60,7 @@ describe('no-obsolete', () => } }); - expect(linterResult.results[0]._postcssResult.messages[index].text).to.equal(message); + expect(linterResult.results.at(0)._postcssResult.messages[index].text).to.equal(message); }); }); }); diff --git a/tests/unit-step.spec.ts b/tests/unit-step.spec.ts index 6f1134e..efd84c3 100644 --- a/tests/unit-step.spec.ts +++ b/tests/unit-step.spec.ts @@ -31,7 +31,7 @@ describe('unit-step', () => } }); - expect(linterResult.results[0]._postcssResult.messages[index].text).to.equal(message); + expect(linterResult.results.at(0)._postcssResult.messages[index].text).to.equal(message); }); }); }); diff --git a/tsconfig.json b/tsconfig.json index 361070b..3651793 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,7 +3,7 @@ { "outDir": "build", "target": "es2015", - "module": "commonjs", + "module": "esnext", "moduleResolution": "node", "declaration": true, "esModuleInterop": true