Skip to content

Commit

Permalink
chore(repo): Move all .d.ts files to types folder & lint (#221)
Browse files Browse the repository at this point in the history
  • Loading branch information
NotWoods committed Feb 28, 2020
1 parent 262cf3d commit 00cdfed
Show file tree
Hide file tree
Showing 21 changed files with 210 additions and 201 deletions.
11 changes: 6 additions & 5 deletions packages/buble/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@
"ci:test": "pnpm run test -- --verbose && pnpm run test:ts",
"lint": "pnpm run lint:js && pnpm run lint:docs && pnpm run lint:package",
"lint:docs": "prettier --single-quote --write README.md",
"lint:js": "eslint --fix --cache src test",
"lint:js": "eslint --fix --cache src test types --ext .js,.ts",
"lint:package": "prettier --write package.json --plugin=prettier-plugin-package",
"prebuild": "del-cli dist",
"prepare": "pnpm run build",
"prepublishOnly": "pnpm run lint && pnpm run test && pnpm run test:ts",
"pretest": "pnpm run build",
"test": "ava",
"test:ts": "tsc index.d.ts test/types.ts --noEmit"
"test:ts": "tsc types/index.d.ts test/types.ts --noEmit"
},
"files": [
"dist",
"index.d.ts",
"src",
"types",
"README.md"
],
"keywords": [
Expand All @@ -46,7 +46,7 @@
"rollup": "^1.20.0"
},
"dependencies": {
"@rollup/pluginutils": "^3.0.4",
"@rollup/pluginutils": "^3.0.8",
"@types/buble": "^0.19.2",
"buble": "^0.19.8"
},
Expand All @@ -64,5 +64,6 @@
"!**/types.ts"
]
},
"module": "dist/rollup-plugin-buble.es.js"
"module": "dist/rollup-plugin-buble.es.js",
"types": "types/index.d.ts"
}
10 changes: 5 additions & 5 deletions packages/buble/test/types.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// @ts-check
import buble, { RollupBubleOptions } from '..';
import { RollupOptions } from 'rollup';

/** @type {import("rollup").RollupOptions} */
const config = {
import buble from '..';

const config: RollupOptions = {
input: 'main.js',
output: {
file: 'bundle.js',
Expand All @@ -13,7 +13,7 @@ const config = {
exclude: 'node_modules/**',
include: 'config.js',
transforms: { modules: true },
objectAssign: true,
objectAssign: true
})
]
};
Expand Down
7 changes: 4 additions & 3 deletions packages/buble/index.d.ts → packages/buble/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import { Plugin } from 'rollup';
import { FilterPattern } from '@rollup/pluginutils';
import { TransformOptions } from 'buble';
import { Plugin } from 'rollup';

export interface RollupBubleOptions extends TransformOptions {
/**
* A minimatch pattern, or array of patterns, of files that should be
* processed by this plugin (if omitted, all files are included by default)
*/
include?: string | RegExp | ReadonlyArray<string | RegExp> | null;
include?: FilterPattern;
/**
* Files that should be excluded, if `include` is otherwise too permissive.
*/
exclude?: string | RegExp | ReadonlyArray<string | RegExp> | null;
exclude?: FilterPattern;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/commonjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"ci:test": "pnpm run test -- --verbose && pnpm run test:ts",
"lint": "pnpm run lint:js && pnpm run lint:docs && pnpm run lint:package",
"lint:docs": "prettier --single-quote --write README.md",
"lint:js": "eslint --fix --cache src test",
"lint:js": "eslint --fix --cache src test types --ext .js,.ts",
"lint:package": "prettier --write package.json --plugin=prettier-plugin-package",
"prebuild": "del-cli dist",
"prepare": "pnpm run build",
Expand All @@ -49,7 +49,7 @@
"rollup": "^1.20.0"
},
"dependencies": {
"@rollup/pluginutils": "^3.0.0",
"@rollup/pluginutils": "^3.0.8",
"estree-walker": "^1.0.1",
"is-reference": "^1.1.2",
"magic-string": "^0.25.2",
Expand Down
34 changes: 17 additions & 17 deletions packages/commonjs/test/types.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import commonjs from '../types';

const config: import("rollup").RollupOptions = {
input: 'main.js',
output: {
file: 'bundle.js',
format: 'iife'
},
plugins: [
commonjs({
include: 'node_modules/**',
exclude: [ 'node_modules/foo/**', 'node_modules/bar/**', /node_modules/ ],
extensions: [ '.js', '.coffee' ],
ignoreGlobal: false,
sourceMap: false,
namedExports: { './module.js': ['foo', 'bar' ] },
ignore: [ 'conditional-runtime-dependency' ]
})
]
const config: import('rollup').RollupOptions = {
input: 'main.js',
output: {
file: 'bundle.js',
format: 'iife'
},
plugins: [
commonjs({
include: 'node_modules/**',
exclude: ['node_modules/foo/**', 'node_modules/bar/**', /node_modules/],
extensions: ['.js', '.coffee'],
ignoreGlobal: false,
sourceMap: false,
namedExports: { './module.js': ['foo', 'bar'] },
ignore: ['conditional-runtime-dependency']
})
]
};

export default config;
83 changes: 42 additions & 41 deletions packages/commonjs/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,47 +1,48 @@
import { FilterPattern } from '@rollup/pluginutils';
import { Plugin } from 'rollup';

interface RollupCommonJSOptions {
/**
* non-CommonJS modules will be ignored, but you can also
* specifically include/exclude files
* @default undefined
*/
include?: string | RegExp | ReadonlyArray<string | RegExp>,
/**
* non-CommonJS modules will be ignored, but you can also
* specifically include/exclude files
* @default undefined
*/
exclude?: string | RegExp | ReadonlyArray<string | RegExp>,
/**
* search for files other than .js files (must already
* be transpiled by a previous plugin!)
* @default [ '.js' ]
*/
extensions?: ReadonlyArray<string | RegExp>,
/**
* if true then uses of `global` won't be dealt with by this plugin
* @default false
*/
ignoreGlobal?: boolean,
/**
* if false then skip sourceMap generation for CommonJS modules
* @default true
*/
sourceMap?: boolean,
/**
* explicitly specify unresolvable named exports
* ([see below for more details](https://github.com/rollup/plugins/tree/master/packages/commonjs#named-exports))
* @default undefined
*/
namedExports?: { [package: string]: ReadonlyArray<string> },
/**
* sometimes you have to leave require statements
* unconverted. Pass an array containing the IDs
* or a `id => boolean` function. Only use this
* option if you know what you're doing!
*/
ignore?: ReadonlyArray<string | ((id: string) => boolean)>,
/**
* non-CommonJS modules will be ignored, but you can also
* specifically include/exclude files
* @default undefined
*/
include?: FilterPattern;
/**
* non-CommonJS modules will be ignored, but you can also
* specifically include/exclude files
* @default undefined
*/
exclude?: FilterPattern;
/**
* search for files other than .js files (must already
* be transpiled by a previous plugin!)
* @default [ '.js' ]
*/
extensions?: ReadonlyArray<string | RegExp>;
/**
* if true then uses of `global` won't be dealt with by this plugin
* @default false
*/
ignoreGlobal?: boolean;
/**
* if false then skip sourceMap generation for CommonJS modules
* @default true
*/
sourceMap?: boolean;
/**
* explicitly specify unresolvable named exports
* ([see below for more details](https://github.com/rollup/plugins/tree/master/packages/commonjs#named-exports))
* @default undefined
*/
namedExports?: { [package: string]: ReadonlyArray<string> };
/**
* sometimes you have to leave require statements
* unconverted. Pass an array containing the IDs
* or a `id => boolean` function. Only use this
* option if you know what you're doing!
*/
ignore?: ReadonlyArray<string | ((id: string) => boolean)>;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/data-uri/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"ci:test": "pnpm run test -- --verbose",
"lint": "pnpm run lint:js && pnpm run lint:docs && pnpm run lint:package",
"lint:docs": "prettier --single-quote --write README.md",
"lint:js": "eslint --fix --cache src test --ext .js,.ts",
"lint:js": "eslint --fix --cache src test types --ext .js,.ts",
"lint:package": "prettier --write package.json --plugin=prettier-plugin-package",
"prebuild": "del-cli dist",
"prepublishOnly": "pnpm run lint && pnpm run build",
Expand Down
40 changes: 0 additions & 40 deletions packages/json/index.d.ts

This file was deleted.

11 changes: 6 additions & 5 deletions packages/json/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@
"ci:test": "pnpm run test -- --verbose && pnpm run test:ts",
"lint": "pnpm run lint:js && pnpm run lint:docs && pnpm run lint:package",
"lint:docs": "prettier --single-quote --write README.md",
"lint:js": "eslint --fix --cache src test",
"lint:js": "eslint --fix --cache src test types --ext .js,.ts",
"lint:package": "prettier --write package.json --plugin=prettier-plugin-package",
"prebuild": "del-cli dist",
"prepare": "pnpm run build",
"prepublishOnly": "pnpm run lint && pnpm run test",
"pretest": "pnpm run build",
"test": "ava",
"test:ts": "tsc index.d.ts test/types.ts --noEmit"
"test:ts": "tsc types/index.d.ts test/types.ts --noEmit"
},
"files": [
"dist",
"index.d.ts",
"types",
"README.md",
"LICENSE"
],
Expand All @@ -46,7 +46,7 @@
"rollup": "^1.20.0"
},
"dependencies": {
"@rollup/pluginutils": "^3.0.4"
"@rollup/pluginutils": "^3.0.8"
},
"devDependencies": {
"@rollup/plugin-buble": "^0.21.0",
Expand All @@ -61,5 +61,6 @@
"!**/types.ts"
]
},
"module": "dist/index.es.js"
"module": "dist/index.es.js",
"types": "types/index.d.ts"
}
38 changes: 19 additions & 19 deletions packages/json/test/types.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
// @ts-check
import json, { RollupJsonOptions } from '..';
import { RollupOptions } from 'rollup';

/** @type {import("rollup").RollupOptions} */
const config = {
input: 'main.js',
output: {
file: 'bundle.js',
format: 'iife'
},
plugins: [
json({
include: 'node_modules/**',
exclude: ['node_modules/foo/**', 'node_modules/bar/**'],
preferConst: true,
indent: ' ',
compact: true,
namedExports: true
})
]
import json from '..';

const config: RollupOptions = {
input: 'main.js',
output: {
file: 'bundle.js',
format: 'iife'
},
plugins: [
json({
include: 'node_modules/**',
exclude: ['node_modules/foo/**', 'node_modules/bar/**'],
preferConst: true,
indent: ' ',
compact: true,
namedExports: true
})
]
};

export default config;
Loading

0 comments on commit 00cdfed

Please sign in to comment.