Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #13

Merged
merged 7 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
],
"rules":
{
"@typescript-eslint/ban-ts-comment": "warn",
"unicorn/prefer-at": "warn"
"@typescript-eslint/ban-ts-comment": "warn"
}
}
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,31 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node 18
- name: Set up Node 20
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
- run: npm install
- run: npm run lint
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node 18
- name: Set up Node 20
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
- run: npm install
- run: npm run build
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node 18
- name: Set up Node 20
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
- run: npm install
- run: npm run test
35 changes: 17 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -32,33 +33,31 @@
},
"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"
},
"main": "index.cjs",
"module": "index.mjs"
}
}
2 changes: 1 addition & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
@@ -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
{
Expand Down
6 changes: 4 additions & 2 deletions src/rules/no-disable/rule.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -12,7 +14,7 @@
return utils.validateOptions(result, ruleName,
{
actual: options,
// @ts-ignore

Check warning on line 17 in src/rules/no-disable/rule.ts

View workflow job for this annotation

GitHub Actions / lint

Do not use "@ts-ignore" because it alters compilation errors

Check warning on line 17 in src/rules/no-disable/rule.ts

View workflow job for this annotation

GitHub Actions / lint

Do not use "@ts-ignore" because it alters compilation errors
possible:
{
commands: value => value
Expand All @@ -30,7 +32,7 @@
{
root.walkComments(comment =>
{
if (options.commands.includes(comment.text.split(' ')[0]))
if (options.commands.includes(comment.text.split(' ').at(0)))
{
utils.report(
{
Expand Down
4 changes: 3 additions & 1 deletion src/rules/no-obsolete/rule.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -12,7 +14,7 @@
return stylelint.utils.validateOptions(result, ruleName,
{
actual: options,
// @ts-ignore

Check warning on line 17 in src/rules/no-obsolete/rule.ts

View workflow job for this annotation

GitHub Actions / lint

Do not use "@ts-ignore" because it alters compilation errors

Check warning on line 17 in src/rules/no-obsolete/rule.ts

View workflow job for this annotation

GitHub Actions / lint

Do not use "@ts-ignore" because it alters compilation errors
possible:
{
atRules: value => value,
Expand Down
4 changes: 3 additions & 1 deletion src/rules/unit-step/rule.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -13,7 +15,7 @@
return utils.validateOptions(result, ruleName,
{
actual: options,
// @ts-ignore

Check warning on line 18 in src/rules/unit-step/rule.ts

View workflow job for this annotation

GitHub Actions / lint

Do not use "@ts-ignore" because it alters compilation errors

Check warning on line 18 in src/rules/unit-step/rule.ts

View workflow job for this annotation

GitHub Actions / lint

Do not use "@ts-ignore" because it alters compilation errors
possible:
{
step: value => value > 0,
Expand Down
9 changes: 5 additions & 4 deletions tests/no-disable.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

import { expect } from 'chai';
import stylelint, { LinterResult } from 'stylelint';
import stylelint, { LinterResult, LinterOptions } from 'stylelint';

const { lint } : typeof stylelint = stylelint;

Expand All @@ -21,17 +22,17 @@ describe('no-disable', () =>
{
plugins:
[
'./src'
'./src/index.ts'
],
rules:
{
'@isnotdefined/no-disable': true
},
ignoreDisables: true
}
});
} as LinterOptions);

expect(linterResult.results[0]._postcssResult.messages[index].text).to.equal(message);
expect(linterResult.results.at(0)._postcssResult.messages[index].text).to.equal(message);
});
});
});
9 changes: 5 additions & 4 deletions tests/no-obsolete.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { expect } from 'chai';
import stylelint, { LinterResult } from 'stylelint';
import stylelint, { LinterResult, LinterOptions } from 'stylelint';

const { lint } : typeof stylelint = stylelint;

describe('no-obsolete', () =>
Expand Down Expand Up @@ -50,16 +51,16 @@ describe('no-obsolete', () =>
{
plugins:
[
'./src'
'./src/index.ts'
],
rules:
{
'@isnotdefined/no-obsolete': true
}
}
});
} as LinterOptions);

expect(linterResult.results[0]._postcssResult.messages[index].text).to.equal(message);
expect(linterResult.results.at(0)._postcssResult.messages[index].text).to.equal(message);
});
});
});
8 changes: 4 additions & 4 deletions tests/unit-step.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect } from 'chai';
import stylelint, { LinterResult } from 'stylelint';
import stylelint, { LinterResult, LinterOptions } from 'stylelint';

const { lint } : typeof stylelint = stylelint;

Expand All @@ -22,16 +22,16 @@ describe('unit-step', () =>
{
plugins:
[
'./src'
'./src/index.ts'
],
rules:
{
'@isnotdefined/unit-step': true
}
}
});
} as LinterOptions);

expect(linterResult.results[0]._postcssResult.messages[index].text).to.equal(message);
expect(linterResult.results.at(0)._postcssResult.messages[index].text).to.equal(message);
});
});
});
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"outDir": "build",
"target": "es2015",
"module": "commonjs",
"module": "esnext",
"moduleResolution": "node",
"declaration": true,
"esModuleInterop": true
Expand Down