Skip to content
This repository was archived by the owner on Mar 7, 2025. It is now read-only.

Commit 59458b5

Browse files
committed
Just serve .d.ts files
This reduce bundle size, cause no nearly empty js files are emitted
1 parent 9ec6792 commit 59458b5

18 files changed

+54
-55
lines changed

.eslintrc.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
// @ts-check
21
const { defineConfig } = require('eslint-define-config');
32

43
module.exports = defineConfig({
5-
ignorePatterns: ['dist/', '.eslintrc.js'],
4+
ignorePatterns: ['src/index.js', '.eslintrc.js'],
65
env: {
76
es6: true,
87
node: true
@@ -16,7 +15,7 @@ module.exports = defineConfig({
1615
],
1716
parser: '@typescript-eslint/parser',
1817
parserOptions: {
19-
project: ['./tsconfig.lint.json'],
18+
project: ['./tsconfig.json'],
2019
warnOnUnsupportedTypeScriptVersion: false
2120
},
2221
plugins: ['@typescript-eslint', 'prettier', 'jsdoc', 'spellcheck', 'inclusive-language'],

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ jobs:
2828
- name: Lint
2929
run: yarn lint
3030

31-
- name: Build
32-
run: yarn build
31+
- name: Check
32+
run: yarn check

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
"name": "eslint-define-config",
33
"version": "1.0.0-alpha.3",
44
"description": "Provide a defineConfig function for .eslintrc.js files",
5-
"main": "dist/index.js",
5+
"main": "src/index.js",
66
"scripts": {
77
"clean": "rm -Rf dist yarn.lock node_modules",
8-
"build": "tsc",
8+
"check": "tsc",
99
"format": "prettier --write .",
1010
"lint": "eslint .",
11-
"prepublishOnly": "yarn clean && yarn install --cache-folder .yarn && yarn build"
11+
"prepublishOnly": "yarn clean && yarn install --cache-folder .yarn && yarn check"
1212
},
1313
"keywords": [
1414
"eslint",
@@ -28,7 +28,6 @@
2828
"bugs": "https://github.com/Shinigami92/eslint-define-config/issues",
2929
"license": "MIT",
3030
"files": [
31-
"dist",
3231
"src",
3332
"tsconfig.json"
3433
],

src/env.ts renamed to src/env.d.ts

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,115 +4,115 @@
44
* @see [Environments](https://eslint.org/docs/user-guide/configuring/language-options#specifying-environments)
55
*/
66
export interface Environments extends Partial<Record<string, boolean>> {
7-
/*
7+
/**
88
* Browser global variables.
99
*/
1010
browser?: boolean;
11-
/*
11+
/**
1212
* Node.js global variables and Node.js scoping.
1313
*/
1414
node?: boolean;
15-
/*
15+
/**
1616
* CommonJS global variables and CommonJS scoping (use this for browser-only code that uses Browserify/WebPack).
1717
*/
1818
commonjs?: boolean;
19-
/*
19+
/**
2020
* Globals common to both Node.js and Browser.
2121
*/
2222
'shared-node-browser'?: boolean;
23-
/*
23+
/**
2424
* Enable all ECMAScript 6 features except for modules (this automatically sets the ecmaVersion parser option to 6).
2525
*/
2626
es6?: boolean;
27-
/*
27+
/**
2828
* Adds all ECMAScript 2017 globals and automatically sets the ecmaVersion parser option to 8.
2929
*/
3030
es2017?: boolean;
31-
/*
31+
/**
3232
* Adds all ECMAScript 2020 globals and automatically sets the ecmaVersion parser option to 11.
3333
*/
3434
es2020?: boolean;
35-
/*
35+
/**
3636
* Adds all ECMAScript 2021 globals and automatically sets the ecmaVersion parser option to 12.
3737
*/
3838
es2021?: boolean;
39-
/*
39+
/**
4040
* Web workers global variables.
4141
*/
4242
worker?: boolean;
43-
/*
43+
/**
4444
* Defines `require()` and `define()` as global variables as per the amd spec.
4545
*/
4646
amd?: boolean;
47-
/*
47+
/**
4848
* Adds all of the Mocha testing global variables.
4949
*/
5050
mocha?: boolean;
51-
/*
51+
/**
5252
* Adds all of the Jasmine testing global variables for version 1.3 and 2.0.
5353
*/
5454
jasmine?: boolean;
55-
/*
55+
/**
5656
* Jest global variables.
5757
*/
5858
jest?: boolean;
59-
/*
59+
/**
6060
* PhantomJS global variables.
6161
*/
6262
phantomjs?: boolean;
63-
/*
63+
/**
6464
* Protractor global variables.
6565
*/
6666
protractor?: boolean;
67-
/*
67+
/**
6868
* QUnit global variables.
6969
*/
7070
qunit?: boolean;
71-
/*
71+
/**
7272
* jQuery global variables.
7373
*/
7474
jquery?: boolean;
75-
/*
75+
/**
7676
* Prototype.js global variables.
7777
*/
7878
prototypejs?: boolean;
79-
/*
79+
/**
8080
* ShellJS global variables.
8181
*/
8282
shelljs?: boolean;
83-
/*
83+
/**
8484
* Meteor global variables.
8585
*/
8686
meteor?: boolean;
87-
/*
87+
/**
8888
* MongoDB global variables.
8989
*/
9090
mongo?: boolean;
91-
/*
91+
/**
9292
* AppleScript global variables.
9393
*/
9494
applescript?: boolean;
95-
/*
95+
/**
9696
* Java 8 Nashorn global variables.
9797
*/
9898
nashorn?: boolean;
99-
/*
99+
/**
100100
* Service Worker global variables.
101101
*/
102102
serviceworker?: boolean;
103-
/*
103+
/**
104104
* Atom test helper globals.
105105
*/
106106
atomtest?: boolean;
107-
/*
107+
/**
108108
* Ember test helper globals.
109109
*/
110110
embertest?: boolean;
111-
/*
111+
/**
112112
* WebExtensions globals.
113113
*/
114114
webextensions?: boolean;
115-
/*
115+
/**
116116
* GreaseMonkey globals.
117117
*/
118118
greasemonkey?: boolean;

src/index.ts renamed to src/index.d.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,4 @@ export interface EslintConfig {
3131
* @param config Eslint config.
3232
* @returns Eslint config.
3333
*/
34-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/explicit-function-return-type
35-
export function defineConfig(config: EslintConfig) {
36-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
37-
return config;
38-
}
34+
export function defineConfig(config: EslintConfig): EslintConfig;

src/index.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
'use strict';
2+
3+
exports.__esModule = true;
4+
exports.defineConfig = void 0;
5+
6+
/**
7+
* Define an eslint config.
8+
*
9+
* @param config Eslint config.
10+
* @returns Eslint config.
11+
*/
12+
function defineConfig(config) {
13+
return config;
14+
}
15+
exports.defineConfig = defineConfig;
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)