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

Change TypeScript definitions for ESM #7309

Merged
merged 2 commits into from
Nov 9, 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
5 changes: 5 additions & 0 deletions .changeset/sixty-lions-build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"stylelint": major
---

Changed: TypeScript definitions for ESM
1 change: 0 additions & 1 deletion lib/augmentConfig.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ const getModulePath = require('./utils/getModulePath.cjs');
const normalizeAllRuleSettings = require('./normalizeAllRuleSettings.cjs');

var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
// @ts-expect-error -- TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'.
const require$1 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('lib/augmentConfig.cjs', document.baseURI).href)));

/** @typedef {import('stylelint').InternalApi} StylelintInternalApi */
Expand Down
2 changes: 1 addition & 1 deletion lib/augmentConfig.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createRequire } from 'node:module';
// @ts-expect-error -- TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'.

const require = createRequire(import.meta.url);

import { dirname, isAbsolute } from 'node:path';
Expand Down Expand Up @@ -81,8 +81,8 @@
export function augmentConfigExtended(cwd) {
return async (cosmiconfigResult) => {
if (!cosmiconfigResult) {
return null;
}

Check warning on line 85 in lib/augmentConfig.mjs

View check run for this annotation

Codecov / codecov/patch

lib/augmentConfig.mjs#L84-L85

Added lines #L84 - L85 were not covered by tests

const configDir = dirname(cosmiconfigResult.filepath || '');
const { config } = cosmiconfigResult;
Expand Down Expand Up @@ -253,16 +253,16 @@
const overridesMerger = {};

if (a.overrides || b.overrides) {
overridesMerger.overrides = [];

if (a.overrides) {
overridesMerger.overrides = overridesMerger.overrides.concat(a.overrides);
}

if (b.overrides) {
overridesMerger.overrides = [...new Set(overridesMerger.overrides.concat(b.overrides))];
}
}

Check warning on line 265 in lib/augmentConfig.mjs

View check run for this annotation

Codecov / codecov/patch

lib/augmentConfig.mjs#L256-L265

Added lines #L256 - L265 were not covered by tests

/** @type {Pick<StylelintConfig, 'extends'>} */
const extendsMerger = {};
Expand Down Expand Up @@ -334,10 +334,10 @@

for (const pluginRuleDefinition of normalizedPluginImport) {
if (!pluginRuleDefinition.ruleName) {
throw configurationError(
`stylelint requires plugins to expose a ruleName. The plugin "${pluginLookup}" is not doing this, so will not work with stylelint. Please file an issue with the plugin.`,
);
}

Check warning on line 340 in lib/augmentConfig.mjs

View check run for this annotation

Codecov / codecov/patch

lib/augmentConfig.mjs#L337-L340

Added lines #L337 - L340 were not covered by tests

if (!pluginRuleDefinition.ruleName.includes('/')) {
throw configurationError(
Expand Down
3 changes: 1 addition & 2 deletions lib/cli.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import process from 'node:process';

import { createRequire } from 'node:module';
// @ts-expect-error -- TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'.

const require = createRequire(import.meta.url);

import picocolors from 'picocolors';
Expand Down Expand Up @@ -421,13 +421,13 @@
return;
}

throw error;
}

Check warning on line 425 in lib/cli.mjs

View check run for this annotation

Codecov / codecov/patch

lib/cli.mjs#L424-L425

Added lines #L424 - L425 were not covered by tests
}

if (isString(stdinFilename)) {
options.codeFilename = stdinFilename;
}

Check warning on line 430 in lib/cli.mjs

View check run for this annotation

Codecov / codecov/patch

lib/cli.mjs#L429-L430

Added lines #L429 - L430 were not covered by tests

if (Array.isArray(ignorePath)) {
options.ignorePath = ignorePath;
Expand All @@ -450,12 +450,12 @@
}

if (isString(cacheLocation)) {
options.cacheLocation = cacheLocation;
}

Check warning on line 454 in lib/cli.mjs

View check run for this annotation

Codecov / codecov/patch

lib/cli.mjs#L453-L454

Added lines #L453 - L454 were not covered by tests

if (isString(cacheStrategy)) {
options.cacheStrategy = cacheStrategy;
}

Check warning on line 458 in lib/cli.mjs

View check run for this annotation

Codecov / codecov/patch

lib/cli.mjs#L457-L458

Added lines #L457 - L458 were not covered by tests

if (isBoolean(fix)) {
options.fix = fix;
Expand Down Expand Up @@ -519,8 +519,8 @@
}

if (isString(outputFile)) {
writeOutputFile(report, outputFile).catch(handleError);
}

Check warning on line 523 in lib/cli.mjs

View check run for this annotation

Codecov / codecov/patch

lib/cli.mjs#L522-L523

Added lines #L522 - L523 were not covered by tests

if (errored) {
process.exitCode = EXIT_CODE_LINT_PROBLEM;
Expand All @@ -544,8 +544,8 @@
*/
function handleError(err) {
if (!isObject(err)) {
throw err;
}

Check warning on line 548 in lib/cli.mjs

View check run for this annotation

Codecov / codecov/patch

lib/cli.mjs#L547-L548

Added lines #L547 - L548 were not covered by tests

if ('stack' in err && isString(err.stack)) {
process.stderr.write(err.stack + EOL);
Expand Down Expand Up @@ -577,7 +577,7 @@
return Promise.resolve(options);
}

return Promise.reject(errorMessage());

Check warning on line 580 in lib/cli.mjs

View check run for this annotation

Codecov / codecov/patch

lib/cli.mjs#L580

Added line #L580 was not covered by tests
}

/**
Expand Down Expand Up @@ -620,7 +620,6 @@
// See also https://github.com/sindresorhus/meow/blob/v12.0.1/source/validate.js#L75
allowUnknownFlags: true,

// @ts-expect-error -- TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'.
importMeta: import.meta,
});
}
2 changes: 1 addition & 1 deletion lib/createPlugin.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
'use strict';

/**
* @type {import('stylelint')['createPlugin']}
* @type {import('stylelint').PublicApi['createPlugin']}
*/
function createPlugin(ruleName, rule) {
return {
Expand Down
2 changes: 1 addition & 1 deletion lib/createPlugin.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @type {import('stylelint')['createPlugin']}
* @type {import('stylelint').PublicApi['createPlugin']}
*/
export default function createPlugin(ruleName, rule) {
return {
Expand Down
2 changes: 1 addition & 1 deletion lib/createStylelint.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const IS_TEST = process.env.NODE_ENV === 'test';
const STOP_DIR = IS_TEST ? process.cwd() : undefined;

/**
* @type {import('stylelint')['_createLinter']}
* @type {import('stylelint').PublicApi['_createLinter']}
*/
function createStylelint(options = {}) {
const cwd = options.cwd || process.cwd();
Expand Down
2 changes: 1 addition & 1 deletion lib/createStylelint.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const IS_TEST = process.env.NODE_ENV === 'test';
const STOP_DIR = IS_TEST ? process.cwd() : undefined;

/**
* @type {import('stylelint')['_createLinter']}
* @type {import('stylelint').PublicApi['_createLinter']}
*/
export default function createStylelint(options = {}) {
const cwd = options.cwd || process.cwd();
Expand Down
2 changes: 1 addition & 1 deletion lib/formatters/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

const _interopNamespaceDefaultOnly = e => Object.freeze({ __proto__: null, default: e });

/** @type {import('stylelint').Formatters} */
/** @type {import('stylelint').PublicApi['formatters']} */
const formatters = {
get compact() {
return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./compactFormatter.cjs'))).then((m) => m.default);
Expand Down
2 changes: 1 addition & 1 deletion lib/formatters/index.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** @type {import('stylelint').Formatters} */
/** @type {import('stylelint').PublicApi['formatters']} */
const formatters = {
get compact() {
return import('./compactFormatter.mjs').then((m) => m.default);
Expand Down
1 change: 0 additions & 1 deletion lib/getPostcssResult.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ const postcss = require('postcss');
const getModulePath = require('./utils/getModulePath.cjs');

var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
// @ts-expect-error -- TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'.
const require$1 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('lib/getPostcssResult.cjs', document.baseURI).href)));

/** @typedef {import('postcss').Result} Result */
Expand Down
2 changes: 1 addition & 1 deletion lib/getPostcssResult.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createRequire } from 'node:module';
// @ts-expect-error -- TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'.

const require = createRequire(import.meta.url);

import { extname } from 'node:path';
Expand Down Expand Up @@ -28,8 +28,8 @@
const cached = options.filePath ? stylelint._postcssResultCache.get(options.filePath) : undefined;

if (cached) {
return cached;
}

Check warning on line 32 in lib/getPostcssResult.mjs

View check run for this annotation

Codecov / codecov/patch

lib/getPostcssResult.mjs#L31-L32

Added lines #L31 - L32 were not covered by tests

const syntax = options.customSyntax
? getCustomSyntax(options.customSyntax, stylelint._options.configBasedir)
Expand All @@ -50,8 +50,8 @@
}

if (getCode === undefined) {
return Promise.reject(new Error('code or filePath required'));
}

Check warning on line 54 in lib/getPostcssResult.mjs

View check run for this annotation

Codecov / codecov/patch

lib/getPostcssResult.mjs#L53-L54

Added lines #L53 - L54 were not covered by tests

const postcssResult = await new LazyResult(postcssProcessor, getCode, postcssOptions);

Expand Down Expand Up @@ -90,8 +90,8 @@
);
}

throw error;
}

Check warning on line 94 in lib/getPostcssResult.mjs

View check run for this annotation

Codecov / codecov/patch

lib/getPostcssResult.mjs#L93-L94

Added lines #L93 - L94 were not covered by tests

/*
* PostCSS allows for syntaxes that only contain a parser, however,
Expand Down
2 changes: 1 addition & 1 deletion lib/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const index = require('./rules/index.cjs');
const standalone = require('./standalone.cjs');
const validateOptions = require('./utils/validateOptions.cjs');

/** @type {import('stylelint')} */
/** @type {import('stylelint').PublicApi} */
const stylelint = Object.assign(postcssPlugin, {
lint: standalone,
rules: index,
Expand Down
2 changes: 1 addition & 1 deletion lib/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import rules from './rules/index.mjs';
import standalone from './standalone.mjs';
import validateOptions from './utils/validateOptions.mjs';

/** @type {import('stylelint')} */
/** @type {import('stylelint').PublicApi} */
const stylelint = Object.assign(postcssPlugin, {
lint: standalone,
rules,
Expand Down
2 changes: 1 addition & 1 deletion lib/resolveConfig.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const createStylelint = require('./createStylelint.cjs');
const getConfigForFile = require('./getConfigForFile.cjs');

/**
* @type {import('stylelint')['resolveConfig']}
* @type {import('stylelint').PublicApi['resolveConfig']}
*/
async function resolveConfig(
filePath,
Expand Down
2 changes: 1 addition & 1 deletion lib/resolveConfig.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import createStylelint from './createStylelint.mjs';
import getConfigForFile from './getConfigForFile.mjs';

/**
* @type {import('stylelint')['resolveConfig']}
* @type {import('stylelint').PublicApi['resolveConfig']}
*/
export default async function resolveConfig(
filePath,
Expand Down
1 change: 0 additions & 1 deletion lib/resolveCustomFormatter.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ const node_fs = require('node:fs');
const node_path = require('node:path');

var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
// @ts-expect-error -- TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'.
const require$1 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('lib/resolveCustomFormatter.cjs', document.baseURI).href)));

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/resolveCustomFormatter.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createRequire } from 'node:module';
// @ts-expect-error -- TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'.

const require = createRequire(import.meta.url);

import { existsSync } from 'node:fs';
Expand Down
8 changes: 5 additions & 3 deletions lib/rules/color-named/colordUtils.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ const colord = colord$1.colord;
/**
* Parses a valid hwb with comma CSS color function
* https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/hwb()#syntax
* @type {import('colord/types').ParseFunction<string>}
* @param {string} input
* @returns {import('colord').RgbaColor | null}
*/
function parseHwbWithCommaString(input) {
input = input.toLowerCase();
Expand Down Expand Up @@ -62,7 +63,8 @@ function parseHwbWithCommaString(input) {

/**
* Parses a valid gray() CSS color function
* @type {import('colord/types').ParseFunction<string>}
* @param {string} input
* @returns {import('colord').RgbaColor | null}
*/
function parseGrayString(input) {
input = input.toLowerCase();
Expand All @@ -84,7 +86,7 @@ function parseGrayString(input) {
}

/**
* @type {import('colord/types').LabColor | import('colord/types').LabaColor}
* @type {import('colord').LabColor | import('colord').LabaColor}
*/
let colorObject = {
l: Number(lightnessWithUnit.number),
Expand Down
8 changes: 5 additions & 3 deletions lib/rules/color-named/colordUtils.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ export const colord = colord_;
/**
* Parses a valid hwb with comma CSS color function
* https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/hwb()#syntax
* @type {import('colord/types').ParseFunction<string>}
* @param {string} input
* @returns {import('colord').RgbaColor | null}
*/
function parseHwbWithCommaString(input) {
input = input.toLowerCase();
Expand Down Expand Up @@ -60,7 +61,8 @@ function parseHwbWithCommaString(input) {

/**
* Parses a valid gray() CSS color function
* @type {import('colord/types').ParseFunction<string>}
* @param {string} input
* @returns {import('colord').RgbaColor | null}
*/
function parseGrayString(input) {
input = input.toLowerCase();
Expand All @@ -82,7 +84,7 @@ function parseGrayString(input) {
}

/**
* @type {import('colord/types').LabColor | import('colord/types').LabaColor}
* @type {import('colord').LabColor | import('colord').LabaColor}
*/
let colorObject = {
l: Number(lightnessWithUnit.number),
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

const _interopNamespaceDefaultOnly = e => Object.freeze({ __proto__: null, default: e });

/** @type {import('stylelint').BuiltInRules} */
/** @type {import('stylelint').PublicApi['rules']} */
const rules = {
get 'alpha-value-notation'() {
return Promise.resolve().then(() => /*#__PURE__*/_interopNamespaceDefaultOnly(require('./alpha-value-notation/index.cjs'))).then((m) => m.default);
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/index.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** @type {import('stylelint').BuiltInRules} */
/** @type {import('stylelint').PublicApi['rules']} */
const rules = {
get 'alpha-value-notation'() {
return import('./alpha-value-notation/index.mjs').then((m) => m.default);
Expand Down
2 changes: 1 addition & 1 deletion lib/standalone.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const ALWAYS_IGNORED_GLOBS = ['**/node_modules/**'];
/** @typedef {import('stylelint').FormatterType} FormatterType */

/**
* @type {import('stylelint')['lint']}
* @type {import('stylelint').PublicApi['lint']}
*/
async function standalone({
allowEmptyInput,
Expand Down
2 changes: 1 addition & 1 deletion lib/standalone.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const ALWAYS_IGNORED_GLOBS = ['**/node_modules/**'];
/** @typedef {import('stylelint').FormatterType} FormatterType */

/**
* @type {import('stylelint')['lint']}
* @type {import('stylelint').PublicApi['lint']}
*/
export default async function standalone({
allowEmptyInput,
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/FileCache.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const hash = require('./hash.cjs');

var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
const debug = createDebug('stylelint:file-cache');
// @ts-expect-error -- TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'.

const pkg = JSON.parse(node_fs.readFileSync(new URL('../../package.json', (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('lib/utils/FileCache.cjs', document.baseURI).href))), 'utf8'));

/** @typedef {import('file-entry-cache').FileDescriptor["meta"] & { hashOfConfig?: string }} CacheMetadata */
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/FileCache.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import getCacheFile from './getCacheFile.mjs';
import hash from './hash.mjs';

const debug = createDebug('stylelint:file-cache');
// @ts-expect-error -- TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'.

const pkg = JSON.parse(readFileSync(new URL('../../package.json', import.meta.url), 'utf8'));

/** @typedef {import('file-entry-cache').FileDescriptor["meta"] & { hashOfConfig?: string }} CacheMetadata */
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/mathMLTags.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
const node_module = require('node:module');

var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
// @ts-expect-error -- TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'
const require$1 = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('lib/utils/mathMLTags.cjs', document.baseURI).href)));

// NOTE: mathml-tag-names v3 is a pure ESM package,
// so we cannot update it while supporting both ESM and CJS.
//
// In addition, mathml-tag-names v2 provides only a JSON file,
// so ESM cannot import it (raises the "ERR_IMPORT_ASSERTION_TYPE_MISSING" error).
// @ts-expect-error -- mathml-tag-names v2 doesn't have type declarations.
const mathMLTags = require$1('mathml-tag-names');

module.exports = mathMLTags;
2 changes: 1 addition & 1 deletion lib/utils/mathMLTags.mjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { createRequire } from 'node:module';

// @ts-expect-error -- TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'
const require = createRequire(import.meta.url);

// NOTE: mathml-tag-names v3 is a pure ESM package,
// so we cannot update it while supporting both ESM and CJS.
//
// In addition, mathml-tag-names v2 provides only a JSON file,
// so ESM cannot import it (raises the "ERR_IMPORT_ASSERTION_TYPE_MISSING" error).
// @ts-expect-error -- mathml-tag-names v2 doesn't have type declarations.
const mathMLTags = require('mathml-tag-names');

export default mathMLTags;
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@
"author": "stylelint",
"exports": {
".": {
"import": "./lib/index.mjs",
"import": {
"types": "./types/stylelint/index.d.ts",
"default": "./lib/index.mjs"
},
"require": "./lib/index.cjs"
},
"./package.json": "./package.json",
Expand Down
16 changes: 16 additions & 0 deletions patches/is-plain-object+5.0.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
diff --git a/node_modules/is-plain-object/package.json b/node_modules/is-plain-object/package.json
index 3ea169a..622dff4 100644
--- a/node_modules/is-plain-object/package.json
+++ b/node_modules/is-plain-object/package.json
@@ -25,7 +25,10 @@
],
"exports": {
".": {
- "import": "./dist/is-plain-object.mjs",
+ "import": {
+ "types": "./is-plain-object.d.ts",
+ "default": "./dist/is-plain-object.mjs"
+ },
"require": "./dist/is-plain-object.js"
},
"./package.json": "./package.json"
15 changes: 8 additions & 7 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"compilerOptions": {
"target": "ES2021",
"module": "commonjs",
"lib": ["ES2021", "DOM"],
"module": "Node16",
"moduleResolution": "Node16",
Copy link
Member

@Mouvedia Mouvedia Nov 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

info

node16 and nodenext are currently identical, with the exception that they imply different target option values. If Node.js makes significant changes to its module system in the future, node16 will be frozen while nodenext will be updated to reflect the new behavior.

and since

--module nodenext implies --target esnext
--module node16 implies --target es2022

node16 is the right choice.

"target": "ES2022",
"lib": ["ES2022"],
"checkJs": true,
"noEmit": true,
"strict": true,
Expand All @@ -12,13 +13,13 @@
"noImplicitReturns": false,
"noUnusedParameters": true,
"noUncheckedIndexedAccess": true,
"resolveJsonModule": true,
"resolveJsonModule": false,
Mouvedia marked this conversation as resolved.
Show resolved Hide resolved
"esModuleInterop": true,
"skipLibCheck": false,
"paths": {
"*": ["./node_modules/@types/*", "./types/*"]
"stylelint": ["./types/stylelint/index.d.ts"]
}
},
"include": ["lib", "types", "package.json"],
"exclude": ["**/*.test.{js,mjs}", "**/__tests__/", "lib/**/*.cjs"]
"include": ["lib/**/*.mjs", "types/**/*.ts"],
"exclude": ["**/__tests__/**"]
Mouvedia marked this conversation as resolved.
Show resolved Hide resolved
}
Loading
Loading