Skip to content

Commit

Permalink
feat: support stylelint v16
Browse files Browse the repository at this point in the history
  • Loading branch information
AndyOGo committed Jan 5, 2024
1 parent 83b5f6b commit cf40d65
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 13 deletions.
14 changes: 9 additions & 5 deletions jest.setup.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const { getTestRule } = require('jest-preset-stylelint');
const { lint } = require('stylelint');
import { getTestRule } from 'jest-preset-stylelint';
import { lint } from 'stylelint';
// eslint-disable-next-line import/extensions
import declarationStrictValuePlugin from './src/index.ts';

global.testRule = getTestRule({ plugins: ['./src/index.ts'] });
const plugins = [declarationStrictValuePlugin];

global.testRule = getTestRule({ plugins });

global.testCustomAutoFixMessage = testCustomAutoFixMessage;

Expand All @@ -19,11 +22,12 @@ function testCustomAutoFixMessage({ ruleName, config, reject, fix }) {
fix,
code,
config: {
plugins: ['./src/index.ts'],
plugins,
rules: {
[ruleName]: config,
},
},
quietDeprecationWarnings: true,
});

return { message, warnings };
Expand Down
2 changes: 1 addition & 1 deletion lint-staged.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
'(src|test)/**/*.[tj]s': (filenames) => [
`eslint --fix ${filenames.join(' ')}`,
'jest',
'cross-env NODE_OPTIONS="--experimental-vm-modules --no-warnings" jest',
],
'(README).md': ["doctoc --title '**Table of Contents**'"],
};
19 changes: 14 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,22 @@
"version": "1.9.2",
"description": "Specify properties for which a variable, function, keyword or value must be used",
"source": "src/index.ts",
"exports": {
"types": "./dist/index.d.ts",
"require": "./dist/index.js",
"default": "./dist/index.mjs.js"
},
"main": "dist/index.js",
"module": "dist/index.esm.js",
"unpkg": "dist/index.umd.js",
"types": "dist/index.d.ts",
"engines": {
"node": ">=18.12.0"
},
"scripts": {
"build": "microbundle --tsconfig tsconfig.build.json --compress",
"release": "dotenv semantic-release",
"test": "jest",
"test": "cross-env NODE_OPTIONS=\"--experimental-vm-modules --no-warnings\" jest",
"coverage": "jest --config='./jest.coverage.config.js'",
"postcoverage": "dotenv codecov",
"eslint": "eslint 'src/**/*.[tj]s' 'test/**/*.[tj]s'",
Expand Down Expand Up @@ -45,7 +53,7 @@
},
"homepage": "https://github.com/AndyOGo/stylelint-declaration-strict-value#readme",
"peerDependencies": {
"stylelint": ">=7 <=15"
"stylelint": ">=7 <=16"
},
"devDependencies": {
"@babel/cli": "^7.12.8",
Expand All @@ -68,6 +76,7 @@
"babel-jest": "^29.4.2",
"babel-register-ts": "^7.0.0",
"codecov": "^3.8.1",
"cross-env": "^7.0.3",
"doctoc": "^2.0.0",
"dotenv-cli": "^4.0.0",
"eslint": "^7.14.0",
Expand All @@ -78,14 +87,14 @@
"eslint-plugin-tsdoc": "^0.2.7",
"husky": "^6.0.0",
"jest": "^29.4.2",
"jest-preset-stylelint": "^6.1.0",
"jest-preset-stylelint": "^7.0.0",
"lint-staged": "^10.5.2",
"microbundle": "^0.12.0",
"microbundle": "^0.15.1",
"nyc": "^15.1.0",
"pinst": "^2.1.6",
"prettier": "^2.2.1",
"semantic-release": "^17.3.0",
"stylelint": "^15.1.0",
"stylelint": "^16.1.0",
"typedoc": "^0.22.7",
"typedoc-plugin-markdown": "^3.2.1",
"typescript": "^4.1.2"
Expand Down
2 changes: 1 addition & 1 deletion src/defaults.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Node, Root } from 'stylelint/node_modules/postcss';
import type { Node, Root } from 'postcss';

/**
* Rule Name.
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Declaration, Root, AtRule } from 'stylelint/node_modules/postcss';
import type { Declaration, Root, AtRule } from 'postcss';
import stylelint, { PostcssResult, Rule } from 'stylelint';
import shortCSS from 'shortcss';
import list from 'shortcss/lib/list';
Expand Down

0 comments on commit cf40d65

Please sign in to comment.