@coko/lint 2.0.1 → 3.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/README.md +1 -1
- package/package.json +46 -31
- package/src/airbnb/variables.mjs +26 -0
- package/src/cli.js +131 -0
- package/src/eslint.mjs +260 -0
- package/src/index.mjs +14 -0
- package/src/index.js +0 -13
- /package/src/{eslint.js → eslint.bak.js} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [3.0.0-alpha.0](https://gitlab.coko.foundation/cokoapps/lint/compare/v2.1.0...v3.0.0-alpha.0) (2025-10-24)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **eslint:** typescript support and drop airbnb for server ([8eaa3c6](https://gitlab.coko.foundation/cokoapps/lint/commit/8eaa3c68dfd666e86215d80ed94bd0a2081209e1))
|
|
11
|
+
|
|
12
|
+
## [2.1.0](https://gitlab.coko.foundation/cokoapps/lint/compare/v2.0.1...v2.1.0) (2024-02-26)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* add cli command for lint checks ([c912ce1](https://gitlab.coko.foundation/cokoapps/lint/commit/c912ce1343ccf92668dfa197f01bd6a9f82043a9))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* add bin entry to package.json for cli ([3ecb2f5](https://gitlab.coko.foundation/cokoapps/lint/commit/3ecb2f5aa35039ff4e06d54782e3b49a9316ff48))
|
|
23
|
+
|
|
5
24
|
### [2.0.1](https://gitlab.coko.foundation/cokoapps/lint/compare/v2.0.0...v2.0.1) (2023-02-23)
|
|
6
25
|
|
|
7
26
|
|
package/README.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Documentation can be found [here](https://dev.
|
|
1
|
+
Documentation can be found [here](https://coko-dev-docs.fly.dev/).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coko/lint",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-alpha.0",
|
|
4
4
|
"description": "Linter configurations and dependencies for coko's projects",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lint",
|
|
@@ -13,7 +13,13 @@
|
|
|
13
13
|
},
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"author": "Yannis Barlas",
|
|
16
|
+
"engines": {
|
|
17
|
+
"node": "^22.16.0"
|
|
18
|
+
},
|
|
16
19
|
"main": "src/index.js",
|
|
20
|
+
"bin": {
|
|
21
|
+
"coko-lint": "./src/cli.js"
|
|
22
|
+
},
|
|
17
23
|
"files": [
|
|
18
24
|
"src"
|
|
19
25
|
],
|
|
@@ -29,44 +35,53 @@
|
|
|
29
35
|
}
|
|
30
36
|
},
|
|
31
37
|
"dependencies": {
|
|
32
|
-
"@babel/core": "^7.
|
|
33
|
-
"@babel/eslint-parser": "^7.
|
|
34
|
-
"@babel/preset-react": "^7.
|
|
35
|
-
"@commitlint/cli": "^
|
|
36
|
-
"@commitlint/config-conventional": "^
|
|
37
|
-
"
|
|
38
|
+
"@babel/core": "^7.28.4",
|
|
39
|
+
"@babel/eslint-parser": "^7.28.4",
|
|
40
|
+
"@babel/preset-react": "^7.27.1",
|
|
41
|
+
"@commitlint/cli": "^20.1.0",
|
|
42
|
+
"@commitlint/config-conventional": "^20.0.0",
|
|
43
|
+
"@eslint/eslintrc": "^3.3.1",
|
|
44
|
+
"@eslint/js": "^9.38.0",
|
|
45
|
+
"commander": "^14.0.1",
|
|
46
|
+
"commitizen": "^4.3.1",
|
|
38
47
|
"conventional-commit-types": "^3.0.0",
|
|
39
48
|
"cz-conventional-changelog": "^3.3.0",
|
|
40
|
-
"cz-customizable": "^6.
|
|
41
|
-
"eslint": "^
|
|
49
|
+
"cz-customizable": "^6.9.0",
|
|
50
|
+
"eslint": "^9.38.0",
|
|
42
51
|
"eslint-config-airbnb": "^19.0.4",
|
|
43
|
-
"eslint-config-prettier": "^
|
|
44
|
-
"eslint-config-standard": "^
|
|
45
|
-
"eslint-config-standard-react": "^
|
|
46
|
-
"eslint-
|
|
47
|
-
"eslint-plugin-
|
|
48
|
-
"eslint-plugin-
|
|
49
|
-
"eslint-plugin-
|
|
50
|
-
"eslint-plugin-
|
|
51
|
-
"eslint-plugin-
|
|
52
|
-
"eslint-plugin-
|
|
53
|
-
"eslint-plugin-react
|
|
54
|
-
"
|
|
55
|
-
"
|
|
52
|
+
"eslint-config-prettier": "^10.1.8",
|
|
53
|
+
"eslint-config-standard": "^17.1.0",
|
|
54
|
+
"eslint-config-standard-react": "^13.0.0",
|
|
55
|
+
"eslint-import-resolver-typescript": "^4.4.4",
|
|
56
|
+
"eslint-plugin-cypress": "^5.2.0",
|
|
57
|
+
"eslint-plugin-import": "^2.32.0",
|
|
58
|
+
"eslint-plugin-jest": "^29.0.1",
|
|
59
|
+
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
60
|
+
"eslint-plugin-n": "^17.23.1",
|
|
61
|
+
"eslint-plugin-promise": "^7.2.1",
|
|
62
|
+
"eslint-plugin-react": "^7.37.5",
|
|
63
|
+
"eslint-plugin-react-hooks": "^7.0.0",
|
|
64
|
+
"globals": "^16.4.0",
|
|
65
|
+
"husky": "^9.1.7",
|
|
66
|
+
"lint-staged": "^16.2.6",
|
|
56
67
|
"longest": "^2.0.1",
|
|
57
|
-
"postcss
|
|
58
|
-
"
|
|
68
|
+
"postcss": "^8.5.6",
|
|
69
|
+
"postcss-scss": "^4.0.9",
|
|
70
|
+
"prettier": "^3.6.2",
|
|
59
71
|
"right-pad": "^1.0.1",
|
|
60
|
-
"stylelint": "^
|
|
61
|
-
"stylelint-config-standard-scss": "^
|
|
72
|
+
"stylelint": "^16.25.0",
|
|
73
|
+
"stylelint-config-standard-scss": "^16.0.0",
|
|
62
74
|
"stylelint-config-styled-components": "^0.1.1",
|
|
63
|
-
"stylelint-order": "^
|
|
64
|
-
"stylelint-processor-styled-components": "^1.10.0"
|
|
75
|
+
"stylelint-order": "^7.0.0",
|
|
76
|
+
"stylelint-processor-styled-components": "^1.10.0",
|
|
77
|
+
"typescript": "^5.9.3",
|
|
78
|
+
"typescript-eslint": "^8.46.2"
|
|
65
79
|
},
|
|
66
80
|
"devDependencies": {
|
|
67
|
-
"standard-version": "^9.
|
|
81
|
+
"standard-version": "^9.5.0"
|
|
68
82
|
},
|
|
69
83
|
"publishConfig": {
|
|
70
84
|
"access": "public"
|
|
71
|
-
}
|
|
72
|
-
|
|
85
|
+
},
|
|
86
|
+
"packageManager": "yarn@4.10.3"
|
|
87
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// const confusingBrowserGlobals = require('confusing-browser-globals')
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
rules: {
|
|
5
|
+
// disallow specific globals
|
|
6
|
+
'no-restricted-globals': [
|
|
7
|
+
'error',
|
|
8
|
+
{
|
|
9
|
+
name: 'isFinite',
|
|
10
|
+
message:
|
|
11
|
+
'Use Number.isFinite instead https://github.com/airbnb/javascript#standard-library--isfinite',
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
name: 'isNaN',
|
|
15
|
+
message:
|
|
16
|
+
'Use Number.isNaN instead https://github.com/airbnb/javascript#standard-library--isnan',
|
|
17
|
+
},
|
|
18
|
+
]
|
|
19
|
+
.concat
|
|
20
|
+
// confusingBrowserGlobals.map(g => ({
|
|
21
|
+
// name: g,
|
|
22
|
+
// message: `Use window.${g} instead. https://github.com/facebook/create-react-app/blob/HEAD/packages/confusing-browser-globals/README.md`,
|
|
23
|
+
// })),
|
|
24
|
+
(),
|
|
25
|
+
},
|
|
26
|
+
}
|
package/src/cli.js
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/* eslint-disable no-console */
|
|
4
|
+
|
|
5
|
+
const { program } = require('commander')
|
|
6
|
+
const { execSync } = require('child_process')
|
|
7
|
+
|
|
8
|
+
const pkg = require('../package.json')
|
|
9
|
+
|
|
10
|
+
const ESLINT = 'ESLint'
|
|
11
|
+
const STYLELINT = 'Stylelint'
|
|
12
|
+
const PRETTIER = 'Prettier'
|
|
13
|
+
const filler = '>>>> '
|
|
14
|
+
|
|
15
|
+
// #region actions
|
|
16
|
+
const printVersion = () => {
|
|
17
|
+
console.log(`Coko lint version: ${program.version()}`)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const runCommand = (name, command, isSubprocess) => {
|
|
21
|
+
console.log(`\n${filler}Running ${name}...`)
|
|
22
|
+
|
|
23
|
+
try {
|
|
24
|
+
execSync(command, { stdio: 'inherit' })
|
|
25
|
+
} catch (error) {
|
|
26
|
+
console.error(`Error running ${name}: ${error.message}`)
|
|
27
|
+
|
|
28
|
+
if (isSubprocess) {
|
|
29
|
+
throw new Error()
|
|
30
|
+
} else {
|
|
31
|
+
process.exit(1)
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const runSubprocess = (fn, name, skip) => {
|
|
37
|
+
try {
|
|
38
|
+
if (skip) {
|
|
39
|
+
console.log(`\n${filler}Skipping ${name}...`)
|
|
40
|
+
return
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
fn(true)
|
|
44
|
+
} catch {
|
|
45
|
+
throw new Error()
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const runESLint = isSubprocess => {
|
|
50
|
+
const command = `npx eslint ${process.cwd()}`
|
|
51
|
+
runCommand(ESLINT, command, isSubprocess)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const runStylelint = isSubprocess => {
|
|
55
|
+
const command = `npx stylelint "${process.cwd()}/**/*.js"`
|
|
56
|
+
runCommand(STYLELINT, command, isSubprocess)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const runPrettier = isSubprocess => {
|
|
60
|
+
const command = `npx prettier --check ${process.cwd()}`
|
|
61
|
+
runCommand(PRETTIER, command, isSubprocess)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const runAll = (options = {}) => {
|
|
65
|
+
let hasErrors = false
|
|
66
|
+
|
|
67
|
+
const processes = [
|
|
68
|
+
[runESLint, ESLINT, options.skipEslint],
|
|
69
|
+
[runStylelint, STYLELINT, options.skipStylelint],
|
|
70
|
+
[runPrettier, PRETTIER, options.skipPrettier],
|
|
71
|
+
]
|
|
72
|
+
|
|
73
|
+
/* eslint-disable-next-line no-restricted-syntax */
|
|
74
|
+
for (const process of processes) {
|
|
75
|
+
try {
|
|
76
|
+
runSubprocess(...process)
|
|
77
|
+
} catch {
|
|
78
|
+
hasErrors = true
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (hasErrors) {
|
|
83
|
+
console.error('\nError: Linting checks did not pass!')
|
|
84
|
+
process.exit(1)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
console.log(`\nLinting checks successfully passed`)
|
|
88
|
+
}
|
|
89
|
+
// #endregion actions
|
|
90
|
+
|
|
91
|
+
program
|
|
92
|
+
.name('coko-lint')
|
|
93
|
+
.version(pkg.version)
|
|
94
|
+
.description("Coko's cli tool for running linters")
|
|
95
|
+
|
|
96
|
+
program
|
|
97
|
+
.command('eslint')
|
|
98
|
+
.description('Run eslint command')
|
|
99
|
+
.action(() => {
|
|
100
|
+
printVersion()
|
|
101
|
+
runESLint()
|
|
102
|
+
})
|
|
103
|
+
|
|
104
|
+
program
|
|
105
|
+
.command('stylelint')
|
|
106
|
+
.description('Run stylelint command')
|
|
107
|
+
.action(() => {
|
|
108
|
+
printVersion()
|
|
109
|
+
runStylelint()
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
program
|
|
113
|
+
.command('prettier')
|
|
114
|
+
.description('Run prettier command')
|
|
115
|
+
.action(() => {
|
|
116
|
+
printVersion()
|
|
117
|
+
runPrettier()
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
program
|
|
121
|
+
.command('run')
|
|
122
|
+
.description('Run all commands (eslint, stylelint, prettier)')
|
|
123
|
+
.option('--skip-eslint', 'Skip eslint')
|
|
124
|
+
.option('--skip-stylelint', 'Skip stylelint')
|
|
125
|
+
.option('--skip-prettier', 'Skip prettier')
|
|
126
|
+
.action(options => {
|
|
127
|
+
printVersion()
|
|
128
|
+
runAll(options)
|
|
129
|
+
})
|
|
130
|
+
|
|
131
|
+
program.parse(process.argv)
|
package/src/eslint.mjs
ADDED
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
// import path from 'path'
|
|
2
|
+
|
|
3
|
+
import { defineConfig, globalIgnores } from 'eslint/config'
|
|
4
|
+
import js from '@eslint/js'
|
|
5
|
+
// import { FlatCompat } from '@eslint/eslintrc'
|
|
6
|
+
|
|
7
|
+
import globals from 'globals'
|
|
8
|
+
import tseslint from 'typescript-eslint'
|
|
9
|
+
// import babelParser from '@babel/eslint-parser'
|
|
10
|
+
|
|
11
|
+
import nodePlugin from 'eslint-plugin-n'
|
|
12
|
+
import importPlugin from 'eslint-plugin-import'
|
|
13
|
+
// import jest from 'eslint-plugin-jest'
|
|
14
|
+
// import cypressPlugin from 'eslint-plugin-cypress'
|
|
15
|
+
|
|
16
|
+
// const __filename = fileURLToPath(import.meta.url)
|
|
17
|
+
// const __dirname = path.dirname(__filename)
|
|
18
|
+
|
|
19
|
+
// const compat = new FlatCompat({
|
|
20
|
+
// // baseDirectory: __dirname,
|
|
21
|
+
// resolvePluginsRelativeTo: import.meta.url,
|
|
22
|
+
// // recommendedConfig: js.configs.recommended,
|
|
23
|
+
// // allConfig: js.configs.all,
|
|
24
|
+
// })
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* TO DO
|
|
28
|
+
*
|
|
29
|
+
* explicit rules from old config
|
|
30
|
+
* jest
|
|
31
|
+
* cypress
|
|
32
|
+
*
|
|
33
|
+
* => client
|
|
34
|
+
* no console
|
|
35
|
+
* jsx a11y
|
|
36
|
+
* airbnb react
|
|
37
|
+
* react recommended
|
|
38
|
+
* react hooks
|
|
39
|
+
* confusing-browser-globals
|
|
40
|
+
*
|
|
41
|
+
* => drop dependencies
|
|
42
|
+
* airbnb
|
|
43
|
+
* @eslint/eslintrc (if not using flat compat)
|
|
44
|
+
* babel eslint parser
|
|
45
|
+
*
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
const commonRules = {
|
|
49
|
+
'array-callback-return': 'error',
|
|
50
|
+
'block-scoped-var': 'error',
|
|
51
|
+
camelcase: ['error', { properties: 'never' }],
|
|
52
|
+
'class-methods-use-this': 'error',
|
|
53
|
+
'consistent-return': 'error',
|
|
54
|
+
'default-case-last': 'error',
|
|
55
|
+
'default-param-last': 'error',
|
|
56
|
+
'dot-notation': 'error',
|
|
57
|
+
eqeqeq: ['error', 'always', { null: 'ignore' }],
|
|
58
|
+
'new-cap': 'error',
|
|
59
|
+
'no-alert': 'error',
|
|
60
|
+
'no-await-in-loop': 'error',
|
|
61
|
+
'no-bitwise': 'error',
|
|
62
|
+
'no-caller': 'error',
|
|
63
|
+
'no-constructor-return': 'error',
|
|
64
|
+
'no-else-return': ['error', { allowElseIf: false }],
|
|
65
|
+
'no-eval': 'error',
|
|
66
|
+
'no-extend-native': 'error',
|
|
67
|
+
'no-extra-bind': 'error',
|
|
68
|
+
'no-extra-label': 'error',
|
|
69
|
+
'no-implied-eval': 'error',
|
|
70
|
+
'no-labels': 'error',
|
|
71
|
+
'no-lone-blocks': 'error',
|
|
72
|
+
'no-loop-func': 'error',
|
|
73
|
+
'no-multi-assign': 'error',
|
|
74
|
+
'no-multi-str': 'error',
|
|
75
|
+
'no-nested-ternary': 'error',
|
|
76
|
+
'no-new': 'error',
|
|
77
|
+
'no-new-func': 'error',
|
|
78
|
+
'no-new-wrappers': 'error',
|
|
79
|
+
'no-plusplus': 'error',
|
|
80
|
+
'no-promise-executor-return': 'error',
|
|
81
|
+
'no-proto': 'error',
|
|
82
|
+
'no-return-assign': ['error', 'always'],
|
|
83
|
+
'no-script-url': 'error',
|
|
84
|
+
'no-self-compare': 'error',
|
|
85
|
+
'no-sequences': 'error',
|
|
86
|
+
'no-shadow': 'error',
|
|
87
|
+
'no-template-curly-in-string': 'warn',
|
|
88
|
+
'no-throw-literal': 'error',
|
|
89
|
+
'no-undef-init': 'warn',
|
|
90
|
+
'no-undefined': 'error',
|
|
91
|
+
'no-unneeded-ternary': ['error', { defaultAssignment: false }],
|
|
92
|
+
'no-unused-expressions': 'error',
|
|
93
|
+
'no-useless-computed-key': 'error',
|
|
94
|
+
'no-useless-constructor': 'error',
|
|
95
|
+
'no-useless-return': 'error',
|
|
96
|
+
'no-var': 'error',
|
|
97
|
+
'no-void': 'error',
|
|
98
|
+
'prefer-const': ['error', { ignoreReadBeforeAssign: true }],
|
|
99
|
+
'prefer-promise-reject-errors': ['error', { allowEmptyReject: true }],
|
|
100
|
+
'prefer-template': 'error',
|
|
101
|
+
radix: 'error',
|
|
102
|
+
semi: 'off',
|
|
103
|
+
yoda: 'error',
|
|
104
|
+
|
|
105
|
+
// import
|
|
106
|
+
'import/first': 'error',
|
|
107
|
+
'import/extensions': [
|
|
108
|
+
'error',
|
|
109
|
+
'ignorePackages',
|
|
110
|
+
{
|
|
111
|
+
js: 'never',
|
|
112
|
+
ts: 'never',
|
|
113
|
+
},
|
|
114
|
+
],
|
|
115
|
+
'import/no-absolute-path': 'error',
|
|
116
|
+
'import/no-cycle': ['error', { maxDepth: '∞' }],
|
|
117
|
+
'import/no-extraneous-dependencies': [
|
|
118
|
+
'error',
|
|
119
|
+
{
|
|
120
|
+
devDependencies: [
|
|
121
|
+
// storybook
|
|
122
|
+
'.storybook/*',
|
|
123
|
+
'**/stories/**/*.js',
|
|
124
|
+
|
|
125
|
+
// tests
|
|
126
|
+
'cypress/**',
|
|
127
|
+
'**/*.spec.js',
|
|
128
|
+
'**/*.test.js',
|
|
129
|
+
'**/__tests__/**/*',
|
|
130
|
+
|
|
131
|
+
// webpack
|
|
132
|
+
'webpack/**',
|
|
133
|
+
|
|
134
|
+
// configs
|
|
135
|
+
'.commitlintrc.js',
|
|
136
|
+
'.cz-config.js',
|
|
137
|
+
'.jest.config.js',
|
|
138
|
+
'.lintstagedrc.js',
|
|
139
|
+
'.prettierrc.js',
|
|
140
|
+
'.stylelintrc.js',
|
|
141
|
+
'eslint.config.js',
|
|
142
|
+
'eslint.config.mjs',
|
|
143
|
+
|
|
144
|
+
// other
|
|
145
|
+
'dev/**',
|
|
146
|
+
],
|
|
147
|
+
},
|
|
148
|
+
],
|
|
149
|
+
'import/no-import-module-exports': 'error',
|
|
150
|
+
'import/no-useless-path-segments': ['error', { commonjs: true }],
|
|
151
|
+
'import/order': ['error', { groups: [['builtin', 'external', 'internal']] }],
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const server = [
|
|
155
|
+
js.configs.recommended,
|
|
156
|
+
importPlugin.flatConfigs.recommended,
|
|
157
|
+
|
|
158
|
+
{
|
|
159
|
+
files: ['**/*.{js,mjs,ts}'],
|
|
160
|
+
languageOptions: {
|
|
161
|
+
globals: { ...globals.node },
|
|
162
|
+
},
|
|
163
|
+
plugins: {
|
|
164
|
+
n: nodePlugin,
|
|
165
|
+
},
|
|
166
|
+
settings: {
|
|
167
|
+
'import/resolver': {
|
|
168
|
+
typescript: {
|
|
169
|
+
alwaysTryTypes: true,
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
n: { tryExtensions: ['.js', '.ts'] },
|
|
173
|
+
},
|
|
174
|
+
rules: {
|
|
175
|
+
...commonRules,
|
|
176
|
+
'no-console': 'error',
|
|
177
|
+
'import/no-unresolved': ['error', { commonjs: true }],
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
|
|
181
|
+
{
|
|
182
|
+
files: ['**/*.js'],
|
|
183
|
+
languageOptions: {
|
|
184
|
+
sourceType: 'commonjs',
|
|
185
|
+
},
|
|
186
|
+
rules: {
|
|
187
|
+
...nodePlugin.configs['flat/recommended-script'].rules,
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
|
|
191
|
+
{
|
|
192
|
+
files: ['**/*.mjs', '**/*.ts'],
|
|
193
|
+
rules: {
|
|
194
|
+
'no-restricted-globals': [
|
|
195
|
+
'error',
|
|
196
|
+
{
|
|
197
|
+
name: '__dirname',
|
|
198
|
+
message:
|
|
199
|
+
'Do not use __dirname; use import.meta.url or process.cwd().',
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
name: '__filename',
|
|
203
|
+
message:
|
|
204
|
+
'Do not use __filename in ES modules or TypeScript; use import.meta.url or path.resolve() instead.',
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
name: 'isFinite',
|
|
208
|
+
message:
|
|
209
|
+
'Use Number.isFinite instead https://github.com/airbnb/javascript#standard-library--isfinite',
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
name: 'isNaN',
|
|
213
|
+
message:
|
|
214
|
+
'Use Number.isNaN instead https://github.com/airbnb/javascript#standard-library--isnan',
|
|
215
|
+
},
|
|
216
|
+
],
|
|
217
|
+
},
|
|
218
|
+
},
|
|
219
|
+
|
|
220
|
+
{
|
|
221
|
+
files: ['**/*.mjs'],
|
|
222
|
+
languageOptions: {
|
|
223
|
+
ecmaVersion: 2022,
|
|
224
|
+
sourceType: 'module',
|
|
225
|
+
},
|
|
226
|
+
rules: {
|
|
227
|
+
...nodePlugin.configs['flat/recommended-module'].rules,
|
|
228
|
+
},
|
|
229
|
+
},
|
|
230
|
+
|
|
231
|
+
{
|
|
232
|
+
files: ['**/*.ts'],
|
|
233
|
+
languageOptions: {
|
|
234
|
+
parser: tseslint.parser,
|
|
235
|
+
sourceType: 'module',
|
|
236
|
+
},
|
|
237
|
+
plugins: {
|
|
238
|
+
'@typescript-eslint': tseslint.plugin,
|
|
239
|
+
},
|
|
240
|
+
rules: {
|
|
241
|
+
...tseslint.configs.recommended.rules,
|
|
242
|
+
'@typescript-eslint/explicit-function-return-type': 'error',
|
|
243
|
+
},
|
|
244
|
+
},
|
|
245
|
+
|
|
246
|
+
globalIgnores([
|
|
247
|
+
'**/_build',
|
|
248
|
+
'**/dist',
|
|
249
|
+
'!**/.storybook',
|
|
250
|
+
'!**/.commitlintrc.js',
|
|
251
|
+
'!**/.cz-config.js',
|
|
252
|
+
'!**/.jest.config.js',
|
|
253
|
+
'!**/.lintstagedrc.js',
|
|
254
|
+
'!**/.prettierrc.js',
|
|
255
|
+
'!**/.stylelintrc.js',
|
|
256
|
+
'**/node_modules',
|
|
257
|
+
]),
|
|
258
|
+
]
|
|
259
|
+
|
|
260
|
+
export { defineConfig as defineEslintConfig, server as serverEslintConfig }
|
package/src/index.mjs
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import commitizen from './commitizen'
|
|
2
|
+
import { defineEslintConfig, serverEslintConfig } from './eslint.mjs'
|
|
3
|
+
import prettier from './prettier'
|
|
4
|
+
import stylelint from './stylelint'
|
|
5
|
+
import lintstaged from './lintstaged'
|
|
6
|
+
|
|
7
|
+
export {
|
|
8
|
+
defineEslintConfig,
|
|
9
|
+
serverEslintConfig,
|
|
10
|
+
stylelint,
|
|
11
|
+
prettier,
|
|
12
|
+
commitizen,
|
|
13
|
+
lintstaged,
|
|
14
|
+
}
|
package/src/index.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
const commitizen = require('./commitizen')
|
|
2
|
-
const eslint = require('./eslint')
|
|
3
|
-
const prettier = require('./prettier')
|
|
4
|
-
const stylelint = require('./stylelint')
|
|
5
|
-
const lintstaged = require('./lintstaged')
|
|
6
|
-
|
|
7
|
-
module.exports = {
|
|
8
|
-
commitizen,
|
|
9
|
-
eslint,
|
|
10
|
-
prettier,
|
|
11
|
-
stylelint,
|
|
12
|
-
lintstaged,
|
|
13
|
-
}
|
|
File without changes
|