Skip to content

Commit

Permalink
Migrate to ESM
Browse files Browse the repository at this point in the history
  • Loading branch information
henryruhs committed Dec 13, 2023
1 parent 7b3d6c9 commit aad24fb
Show file tree
Hide file tree
Showing 11 changed files with 35 additions and 28 deletions.
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"
}
}
4 changes: 2 additions & 2 deletions .mocharc.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
31 changes: 16 additions & 15 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,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"
},
Expand Down
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 Down Expand Up @@ -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(
{
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 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 Down
2 changes: 1 addition & 1 deletion tests/no-disable.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});
});
3 changes: 2 additions & 1 deletion 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';

const { lint } : typeof stylelint = stylelint;

describe('no-obsolete', () =>
Expand Down Expand Up @@ -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);
});
});
});
2 changes: 1 addition & 1 deletion tests/unit-step.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});
});
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

0 comments on commit aad24fb

Please sign in to comment.