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

Commit 4a6bc07

Browse files
committed
Initial setup
1 parent 04b3078 commit 4a6bc07

17 files changed

+1387
-2
lines changed

.editorconfig

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
11+
[*.md]
12+
max_line_length = off
13+
trim_trailing_whitespace = false

.eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist/

.eslintrc.json

+106
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
{
2+
"env": {
3+
"es6": true,
4+
"node": true
5+
},
6+
"extends": [
7+
"eslint:recommended",
8+
"plugin:@typescript-eslint/recommended",
9+
"plugin:@typescript-eslint/recommended-requiring-type-checking",
10+
"plugin:jsdoc/recommended",
11+
"plugin:prettier/recommended"
12+
],
13+
"parser": "@typescript-eslint/parser",
14+
"parserOptions": {
15+
"project": ["./tsconfig.lint.json"],
16+
"warnOnUnsupportedTypeScriptVersion": false
17+
},
18+
"plugins": ["@typescript-eslint", "prettier", "jsdoc", "spellcheck", "inclusive-language"],
19+
"rules": {
20+
"curly": ["error"],
21+
"linebreak-style": ["error", "unix"],
22+
"no-case-declarations": "warn",
23+
"quotes": ["error", "single", { "avoidEscape": true }],
24+
"semi": ["error", "always"],
25+
26+
"@typescript-eslint/ban-ts-comment": "off",
27+
"@typescript-eslint/explicit-function-return-type": ["error", { "allowExpressions": true }],
28+
"@typescript-eslint/indent": ["error", 2, { "SwitchCase": 1, "ignoredNodes": ["MemberExpression"] }],
29+
"@typescript-eslint/interface-name-prefix": "off",
30+
"@typescript-eslint/member-ordering": "warn",
31+
"@typescript-eslint/no-explicit-any": "off",
32+
"@typescript-eslint/no-inferrable-types": "off",
33+
"@typescript-eslint/no-parameter-properties": "off",
34+
"@typescript-eslint/no-unsafe-assignment": "off",
35+
"@typescript-eslint/no-unused-vars": "off",
36+
"@typescript-eslint/prefer-nullish-coalescing": "warn",
37+
"@typescript-eslint/prefer-optional-chain": "warn",
38+
"@typescript-eslint/prefer-readonly": ["warn"],
39+
"@typescript-eslint/restrict-template-expressions": "off",
40+
"@typescript-eslint/typedef": ["warn", { "memberVariableDeclaration": true, "variableDeclaration": true }],
41+
42+
"jsdoc/match-description": [
43+
"warn",
44+
{
45+
"mainDescription": "/^[A-Z`].+?(\\.|:)(\\n\\n.*((\\n{1,2}- .+)|(_.+_)|`.+`|\\n\\n---))?$/us",
46+
"matchDescription": "^[A-Z`].+(\\.|`.+`)$",
47+
"contexts": ["any"],
48+
"tags": {
49+
"param": true,
50+
"returns": true
51+
}
52+
}
53+
],
54+
"jsdoc/no-types": "error",
55+
"jsdoc/require-jsdoc": [
56+
"warn",
57+
{
58+
"contexts": [
59+
"ClassDeclaration",
60+
"ClassProperty:not([accessibility='private'])",
61+
"ExportNamedDeclaration:has(VariableDeclaration)",
62+
"FunctionExpression",
63+
"MethodDefinition:not([accessibility='private']) > FunctionExpression",
64+
"TSEnumDeclaration",
65+
"TSInterfaceDeclaration",
66+
"TSMethodSignature",
67+
// 'TSPropertySignature',
68+
"TSTypeAliasDeclaration"
69+
]
70+
}
71+
],
72+
"jsdoc/require-param-type": "off",
73+
"jsdoc/require-returns-type": "off",
74+
75+
"spellcheck/spell-checker": [
76+
"warn",
77+
{
78+
"minLength": 3,
79+
"skipWords": []
80+
}
81+
],
82+
83+
"inclusive-language/use-inclusive-words": [
84+
"warn",
85+
{
86+
"allowedTerms": [
87+
{
88+
"term": "/master",
89+
"allowPartialMatches": true
90+
}
91+
],
92+
"words": [
93+
{
94+
"word": "guys",
95+
"suggestions": ["folks"]
96+
}
97+
]
98+
}
99+
]
100+
},
101+
"settings": {
102+
"jsdoc": {
103+
"mode": "typescript"
104+
}
105+
}
106+
}

.github/CODEOWNERS

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Owner
2+
* @Shinigami92

.github/workflows/ci.yml

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
build:
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
matrix:
14+
os: [ubuntu-latest, macos-latest, windows-latest]
15+
node: [12.x, 14.x, 15.x]
16+
fail-fast: false
17+
18+
steps:
19+
- name: Set git to use LF on Windows
20+
if: matrix.os == 'windows-latest'
21+
run: |
22+
git config --global core.autocrlf false
23+
git config --global core.eol lf
24+
25+
- name: Checkout
26+
uses: actions/checkout@v2
27+
28+
- name: Set node version to ${{ matrix.node }}
29+
uses: actions/setup-node@v1
30+
with:
31+
node-version: ${{ matrix.node }}
32+
33+
- name: Versions
34+
run: yarn versions
35+
36+
- name: Install dependencies
37+
run: yarn install --frozen-lockfile
38+
39+
- name: Lint
40+
if: matrix.os == 'ubuntu-latest' && matrix.node == '14.x'
41+
run: yarn lint
42+
43+
- name: Build
44+
run: yarn build
45+
46+
- name: Test
47+
run: yarn jest --ci --silent --reporters=default --reporters=jest-junit
48+
49+
- name: Upload test artifact
50+
uses: actions/upload-artifact@v2
51+
if: ${{ always() }}
52+
with:
53+
name: JUnit_${{ matrix.os }}_${{ matrix.node }}_${{ github.sha }}
54+
path: junit.xml
55+
56+
- name: Audit dependencies
57+
run: yarn audit --groups dependencies
58+
59+
- name: Audit peerDependencies
60+
run: yarn audit --groups peerDependencies
61+
62+
- name: Check outdated dependencies
63+
if: github.ref == 'refs/heads/main'
64+
run: yarn outdated

.prettierignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.github/ISSUE_TEMPLATE/
2+
coverage/
3+
dist/

.prettierrc.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"arrowParens": "always",
3+
"bracketSpacing": true,
4+
"printWidth": 120,
5+
"semi": true,
6+
"singleQuote": true,
7+
"tabWidth": 2,
8+
"trailingComma": "none",
9+
"useTabs": false
10+
}

.vscode/extensions.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"recommendations": ["esbenp.prettier-vscode", "dbaeumer.vscode-eslint", "streetsidesoftware.code-spell-checker"]
3+
}

.vscode/settings.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"cSpell.words": ["Quadflieg", "readonly", "typeof"],
3+
"eslint.validate": ["javascript", "typescript"],
4+
"typescript.tsdk": "node_modules/typescript/lib"
5+
}

CHANGELOG.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Next
2+
3+
[diff](https://github.com/Shinigami92/eslint-define-config/compare/1.0.0-alpha.1...main)
4+
5+
# 1.0.0-alpha.1
6+
7+
[diff](https://github.com/Shinigami92/eslint-define-config/compare/04b307804a9f9ef6aa288fa6ca167d8336c6145f...1.0.0-alpha.1)
8+
9+
- Initial alpha release

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2021 Shinigami
3+
Copyright (c) 2021 Christopher Quadflieg
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
# eslint-define-config
2-
Provide a defineConfig function for .eslintrc.js files
2+
3+
Provide a `defineConfig` function for `.eslintrc.js` files.

package.json

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"name": "eslint-define-config",
3+
"version": "1.0.0-alpha.1",
4+
"description": "Provide a defineConfig function for .eslintrc.js files",
5+
"main": "dist/index.js",
6+
"scripts": {
7+
"clean": "rm -Rf dist yarn.lock node_modules",
8+
"build": "tsc",
9+
"format": "prettier --write .",
10+
"lint": "eslint .",
11+
"prepublishOnly": "yarn clean && yarn install --cache-folder .yarn && yarn build"
12+
},
13+
"keywords": [
14+
"eslint",
15+
"define-config",
16+
"config",
17+
"typed"
18+
],
19+
"author": {
20+
"name": "Christopher Quadflieg",
21+
"email": "[email protected]",
22+
"url": "https://github.com/Shinigami92"
23+
},
24+
"repository": {
25+
"type": "git",
26+
"url": "https://github.com/Shinigami92/eslint-define-config.git"
27+
},
28+
"bugs": "https://github.com/Shinigami92/eslint-define-config/issues",
29+
"license": "MIT",
30+
"files": [
31+
"dist",
32+
"src",
33+
"tsconfig.json"
34+
],
35+
"devDependencies": {
36+
"@types/node": "~14.14.35",
37+
"@typescript-eslint/eslint-plugin": "~4.19.0",
38+
"@typescript-eslint/parser": "~4.19.0",
39+
"eslint": "~7.22.0",
40+
"eslint-config-prettier": "~8.1.0",
41+
"eslint-plugin-inclusive-language": "~2.1.1",
42+
"eslint-plugin-jsdoc": "~32.3.0",
43+
"eslint-plugin-prettier": "~3.3.1",
44+
"eslint-plugin-spellcheck": "~0.0.17",
45+
"prettier": "2.2.1",
46+
"prettier-plugin-organize-imports": "~1.1.1",
47+
"typescript": "~4.2.3"
48+
}
49+
}

src/index.ts

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/**
2+
* Define an eslint config.
3+
*
4+
* @param config Eslint config.
5+
* @returns Eslint config.
6+
*/
7+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/explicit-function-return-type
8+
export function defineConfig(config: any) {
9+
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
10+
return config;
11+
}

tsconfig.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"compilerOptions": {
3+
"target": "ES2018",
4+
"module": "CommonJS",
5+
"inlineSourceMap": true,
6+
"lib": ["ES2018", "DOM"],
7+
"outDir": "dist",
8+
"moduleResolution": "Node",
9+
"rootDir": "src",
10+
"strict": true,
11+
"noUncheckedIndexedAccess": true
12+
},
13+
"include": ["src/**/*"],
14+
"exclude": ["node_modules"]
15+
}

tsconfig.lint.json

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"compilerOptions": {
3+
"target": "ES2018",
4+
"module": "CommonJS",
5+
"lib": ["ES2018", "DOM"],
6+
"moduleResolution": "Node",
7+
"rootDir": ".",
8+
"strict": true,
9+
"noEmit": true
10+
},
11+
"exclude": ["node_modules"]
12+
}

0 commit comments

Comments
 (0)