@coko/lint 2.1.0 → 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 CHANGED
@@ -2,6 +2,13 @@
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
+
5
12
  ## [2.1.0](https://gitlab.coko.foundation/cokoapps/lint/compare/v2.0.1...v2.1.0) (2024-02-26)
6
13
 
7
14
 
package/README.md CHANGED
@@ -1 +1 @@
1
- Documentation can be found [here](https://dev.coko.foundation/?path=/docs/common-libraries-lint--page).
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": "2.1.0",
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,6 +13,9 @@
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",
17
20
  "bin": {
18
21
  "coko-lint": "./src/cli.js"
@@ -32,45 +35,53 @@
32
35
  }
33
36
  },
34
37
  "dependencies": {
35
- "@babel/core": "^7.17.7",
36
- "@babel/eslint-parser": "^7.17.0",
37
- "@babel/preset-react": "^7.16.7",
38
- "@commitlint/cli": "^16.2.3",
39
- "@commitlint/config-conventional": "^16.2.1",
40
- "commander": "^11.1.0",
41
- "commitizen": "^4.2.4",
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",
42
47
  "conventional-commit-types": "^3.0.0",
43
48
  "cz-conventional-changelog": "^3.3.0",
44
- "cz-customizable": "^6.3.0",
45
- "eslint": "^8.11.0",
49
+ "cz-customizable": "^6.9.0",
50
+ "eslint": "^9.38.0",
46
51
  "eslint-config-airbnb": "^19.0.4",
47
- "eslint-config-prettier": "^8.5.0",
48
- "eslint-config-standard": "^16.0.3",
49
- "eslint-config-standard-react": "^11.0.1",
50
- "eslint-plugin-cypress": "^2.12.1",
51
- "eslint-plugin-import": "^2.25.4",
52
- "eslint-plugin-jest": "^26.1.1",
53
- "eslint-plugin-jsx-a11y": "^6.5.1",
54
- "eslint-plugin-node": "^11.1.0",
55
- "eslint-plugin-promise": "^6.0.0",
56
- "eslint-plugin-react": "^7.29.4",
57
- "eslint-plugin-react-hooks": "^4.3.0",
58
- "husky": "^7.0.4",
59
- "lint-staged": "^12.3.7",
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",
60
67
  "longest": "^2.0.1",
61
- "postcss-scss": "^4.0.3",
62
- "prettier": "^2.6.0",
68
+ "postcss": "^8.5.6",
69
+ "postcss-scss": "^4.0.9",
70
+ "prettier": "^3.6.2",
63
71
  "right-pad": "^1.0.1",
64
- "stylelint": "^14.6.0",
65
- "stylelint-config-standard-scss": "^3.0.0",
72
+ "stylelint": "^16.25.0",
73
+ "stylelint-config-standard-scss": "^16.0.0",
66
74
  "stylelint-config-styled-components": "^0.1.1",
67
- "stylelint-order": "^5.0.0",
68
- "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"
69
79
  },
70
80
  "devDependencies": {
71
- "standard-version": "^9.3.2"
81
+ "standard-version": "^9.5.0"
72
82
  },
73
83
  "publishConfig": {
74
84
  "access": "public"
75
- }
76
- }
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 CHANGED
File without changes
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