@futagoza/eslint-config-javascript 16.1.0 → 17.0.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/README.md CHANGED
@@ -1,49 +1,77 @@
1
- [![dependencies](https://img.shields.io/david/futagoza/eslint-config-futagozaryuu.svg?path=packages/@futagoza/eslint-config-javascript)](https://david-dm.org/futagoza/eslint-config-futagozaryuu?path=packages/@futagoza/eslint-config-javascript)
2
- [![History](https://img.shields.io/badge/history-CHANGELOG.md-orange.svg)](https://github.com/futagoza/eslint-config-futagozaryuu/blob/master/CHANGELOG.md)
3
- [![License](https://img.shields.io/badge/license-mit-blue.svg)](https://opensource.org/licenses/MIT)
4
-
5
- > This package contains configuration files for ESLint v7.15+<br>
6
-
7
- These are configuration files for ESLint that are used to lint my JavaScript projects.
8
-
9
- **NOTE:** Since the base configuration includes [@futagoza/eslint-config-core][ECC], all the configurations also include it; this ensures you don't have to include [@futagoza/eslint-config-core][ECC] as a dependency when using this package.
10
-
11
- ## installation
12
-
13
- ```console
14
- $ npm i --save-dev @futagoza/eslint-config-javascript
15
- ```
16
-
17
- ## usage
18
-
19
- Put the following into your configuration (`.eslintrc.*` file or the _"eslintConfig"_ field in `package.json`):
20
-
21
- ```json
22
- {
23
- "extends": "@futagoza/javascript"
24
- }
25
- ```
26
-
27
- ## configurations
28
-
29
- A list of usable configurations as well the configurations they use:
30
-
31
- - __`@futagoza/javascript`__ (_default_, extends: _esnext_)
32
- - __`@futagoza/javascript/es5`__ (extends [@futagoza/core][ECC] and _[@futagoza/globals/es5][ECG]_)
33
- - __`@futagoza/javascript/es2015`__ (extends: _es5_, _[@futagoza/globals/es2015][ECG]_ and [@futagoza/core/ecmascript-6][ECC])
34
- - __`@futagoza/javascript/es2016`__ (extends: _es2015_)
35
- - __`@futagoza/javascript/es2017`__ (extends: _es2016_ and _[@futagoza/globals/es2017][ECG]_)
36
- - __`@futagoza/javascript/es2018`__ (extends: _es2017_)
37
- - __`@futagoza/javascript/es2019`__ (extends: _es2018_)
38
- - __`@futagoza/javascript/es2020`__ (extends: _es2019_ and _[@futagoza/globals/es2020][ECG]_)
39
- - __`@futagoza/javascript/es2021`__ (extends: _es2020_ and _[@futagoza/globals/es2021][ECG]_)
40
- - __`@futagoza/javascript/esnext`__ (extends: _es2021_)
41
- - __`@futagoza/javascript/modules`__
42
-
43
- [ECC]: https://www.npmjs.com/package/@futagoza/eslint-config-core
44
- [ECG]: https://www.npmjs.com/package/@futagoza/eslint-config-globals
45
-
46
- ## license
47
-
48
- Copyright © 2017+ Futago-za Ryuu<br>
49
- Released under the MIT License, [http://opensource.org/licenses/MIT](http://opensource.org/licenses/MIT)
1
+ > This package contains configuration files for ESLint v10+<br>
2
+
3
+ These are configuration files for ESLint that are used to lint my JavaScript projects.
4
+
5
+ **NOTE:** All the main configuration files...
6
+ - extend [@futagoza/eslint-config-core](https://www.npmjs.com/package/@futagoza/eslint-config-core), so it's already included as a dependency when using this package
7
+ - extend their relevant configuration files from [@futagoza/eslint-config-globals](https://www.npmjs.com/package/@futagoza/eslint-config-globals) (e.g `@futagoza/eslint-config-javascript/es2022.js` extends `@futagoza/eslint-config-globals/es2022.js`)
8
+
9
+ ## installation
10
+
11
+ ```console
12
+ $ npm i --save-dev @futagoza/eslint-config-javascript
13
+ ```
14
+
15
+ ## usage
16
+
17
+ Put the following into your eslint configuration file:
18
+
19
+ ```js
20
+ import { defineConfig } from "eslint/config"
21
+ import javascript from "@futagoza/eslint-config-javascript"
22
+
23
+ // Used alongside other configurations:
24
+ export default [
25
+
26
+ // ...
27
+
28
+ javascript,
29
+
30
+ // ...
31
+
32
+ ]
33
+
34
+ // Used as base configuration for other configurations:
35
+ export default defineConfig(
36
+ {
37
+
38
+ // ...
39
+
40
+ extends: [ javascript ],
41
+
42
+ // ...
43
+
44
+ },
45
+ )
46
+ ```
47
+
48
+ ## configurations
49
+
50
+ A list of importable ESLint configuration files:
51
+
52
+ - __`@futagoza/eslint-config-javascript`__ (_alias for my current default_)
53
+ - __`@futagoza/eslint-config-javascript/es5.js`__
54
+ - __`@futagoza/eslint-config-javascript/es2015.js`__
55
+ - __`@futagoza/eslint-config-javascript/es2016.js`__
56
+ - __`@futagoza/eslint-config-javascript/es2017.js`__
57
+ - __`@futagoza/eslint-config-javascript/es2018.js`__
58
+ - __`@futagoza/eslint-config-javascript/es2019.js`__
59
+ - __`@futagoza/eslint-config-javascript/es2020.js`__
60
+ - __`@futagoza/eslint-config-javascript/es2021.js`__
61
+ - __`@futagoza/eslint-config-javascript/es2022.js`__
62
+ - __`@futagoza/eslint-config-javascript/es2023.js`__ (_default_)
63
+ - __`@futagoza/eslint-config-javascript/es2024.js`__
64
+ - __`@futagoza/eslint-config-javascript/es2025.js`__
65
+ - __`@futagoza/eslint-config-javascript/es2026.js`__
66
+
67
+ Additionally, there are some base configuration files that help target source types (the intention was to use them with the above configuration files, but I ended up finding a much better way to implement them and decided to leave these as they can provide a way to quickly switch (or target) source types; e.g. commonjs on Node):
68
+
69
+ - __`@futagoza/eslint-config-javascript/common.js`__ _(common.js based JavaScript modules)_
70
+ - __`@futagoza/eslint-config-javascript/latest.js`__ _(the latest supported JavaScript version by ESLint; e.g. ESNext)_
71
+ - __`@futagoza/eslint-config-javascript/module.js`__ _(ES2015+ import/export based JavaScript modules)_
72
+ - __`@futagoza/eslint-config-javascript/script.js`__ _(plain JavaScript code)_
73
+
74
+ ## license
75
+
76
+ Copyright © 2017+ Futago-za Ryuu<br>
77
+ Released under the MIT License, [http://opensource.org/licenses/MIT](http://opensource.org/licenses/MIT)
package/common.js ADDED
@@ -0,0 +1,21 @@
1
+ export const config = {
2
+
3
+ name: "@futagoza/eslint-config-javascript/commonjs",
4
+
5
+ // language: "js/js",
6
+
7
+ languageOptions: {
8
+
9
+ sourceType: "commonjs",
10
+
11
+ },
12
+
13
+ rules: {
14
+
15
+ "strict": [ "error", "global" ],
16
+
17
+ },
18
+
19
+ }
20
+
21
+ export default [ config ]
package/es2015.js CHANGED
@@ -1,19 +1,14 @@
1
- "use strict";
1
+ import CreateConfig from "./internal/create-config.js"
2
2
 
3
- module.exports = {
3
+ const x = await CreateConfig( 2015, {
4
4
 
5
- "extends": [
5
+ rules: {
6
6
 
7
- "./es5.js",
8
- "@futagoza/globals/es2015",
9
- "@futagoza/core/ecmascript-6",
10
-
11
- ],
12
-
13
- "parserOptions": {
14
-
15
- "ecmaVersion": 6,
7
+ "prefer-object-has-own": "off",
16
8
 
17
9
  },
18
10
 
19
- };
11
+ } )
12
+
13
+ export const config = x.ConfigObject
14
+ export default x.ConfigArray
package/es2016.js CHANGED
@@ -1,13 +1,14 @@
1
- "use strict";
1
+ import CreateConfig from "./internal/create-config.js"
2
2
 
3
- module.exports = {
3
+ const x = await CreateConfig( 2016, {
4
4
 
5
- "extends": "./es2015.js",
5
+ rules: {
6
6
 
7
- "parserOptions": {
8
-
9
- "ecmaVersion": 7,
7
+ "prefer-object-has-own": "off",
10
8
 
11
9
  },
12
10
 
13
- };
11
+ } )
12
+
13
+ export const config = x.ConfigObject
14
+ export default x.ConfigArray
package/es2017.js CHANGED
@@ -1,18 +1,14 @@
1
- "use strict";
1
+ import CreateConfig from "./internal/create-config.js"
2
2
 
3
- module.exports = {
3
+ const x = await CreateConfig( 2017, {
4
4
 
5
- "extends": [
5
+ rules: {
6
6
 
7
- "./es2016.js",
8
- "@futagoza/globals/es2017",
9
-
10
- ],
11
-
12
- "parserOptions": {
13
-
14
- "ecmaVersion": 8,
7
+ "prefer-object-has-own": "off",
15
8
 
16
9
  },
17
10
 
18
- };
11
+ } )
12
+
13
+ export const config = x.ConfigObject
14
+ export default x.ConfigArray
package/es2018.js CHANGED
@@ -1,13 +1,14 @@
1
- "use strict";
1
+ import CreateConfig from "./internal/create-config.js"
2
2
 
3
- module.exports = {
3
+ const x = await CreateConfig( 2018, {
4
4
 
5
- "extends": "./es2017.js",
5
+ rules: {
6
6
 
7
- "parserOptions": {
8
-
9
- "ecmaVersion": 9,
7
+ "prefer-object-has-own": "off",
10
8
 
11
9
  },
12
10
 
13
- };
11
+ } )
12
+
13
+ export const config = x.ConfigObject
14
+ export default x.ConfigArray
package/es2019.js CHANGED
@@ -1,13 +1,14 @@
1
- "use strict";
1
+ import CreateConfig from "./internal/create-config.js"
2
2
 
3
- module.exports = {
3
+ const x = await CreateConfig( 2019, {
4
4
 
5
- "extends": "./es2018.js",
5
+ rules: {
6
6
 
7
- "parserOptions": {
8
-
9
- "ecmaVersion": 10,
7
+ "prefer-object-has-own": "off",
10
8
 
11
9
  },
12
10
 
13
- };
11
+ } )
12
+
13
+ export const config = x.ConfigObject
14
+ export default x.ConfigArray
package/es2020.js CHANGED
@@ -1,18 +1,14 @@
1
- "use strict";
1
+ import CreateConfig from "./internal/create-config.js"
2
2
 
3
- module.exports = {
3
+ const x = await CreateConfig( 2020, {
4
4
 
5
- "extends": [
5
+ rules: {
6
6
 
7
- "./es2019.js",
8
- "@futagoza/globals/es2020",
9
-
10
- ],
11
-
12
- "parserOptions": {
13
-
14
- "ecmaVersion": 11,
7
+ "prefer-object-has-own": "off",
15
8
 
16
9
  },
17
10
 
18
- };
11
+ } )
12
+
13
+ export const config = x.ConfigObject
14
+ export default x.ConfigArray
package/es2021.js CHANGED
@@ -1,18 +1,14 @@
1
- "use strict";
1
+ import CreateConfig from "./internal/create-config.js"
2
2
 
3
- module.exports = {
3
+ const x = await CreateConfig( 2021, {
4
4
 
5
- "extends": [
5
+ rules: {
6
6
 
7
- "./es2020.js",
8
- "@futagoza/globals/es2021",
9
-
10
- ],
11
-
12
- "parserOptions": {
13
-
14
- "ecmaVersion": 12,
7
+ "prefer-object-has-own": "off",
15
8
 
16
9
  },
17
10
 
18
- };
11
+ } )
12
+
13
+ export const config = x.ConfigObject
14
+ export default x.ConfigArray
package/es2022.js ADDED
@@ -0,0 +1,6 @@
1
+ import CreateConfig from "./internal/create-config.js"
2
+
3
+ const x = await CreateConfig( 2022 )
4
+
5
+ export const config = x.ConfigObject
6
+ export default x.ConfigArray
package/es2023.js ADDED
@@ -0,0 +1,6 @@
1
+ import CreateConfig from "./internal/create-config.js"
2
+
3
+ const x = await CreateConfig( 2023 )
4
+
5
+ export const config = x.ConfigObject
6
+ export default x.ConfigArray
package/es2024.js ADDED
@@ -0,0 +1,6 @@
1
+ import CreateConfig from "./internal/create-config.js"
2
+
3
+ const x = await CreateConfig( 2024 )
4
+
5
+ export const config = x.ConfigObject
6
+ export default x.ConfigArray
package/es2025.js ADDED
@@ -0,0 +1,6 @@
1
+ import CreateConfig from "./internal/create-config.js"
2
+
3
+ const x = await CreateConfig( 2025 )
4
+
5
+ export const config = x.ConfigObject
6
+ export default x.ConfigArray
package/es2026.js ADDED
@@ -0,0 +1,6 @@
1
+ import CreateConfig from "./internal/create-config.js"
2
+
3
+ const x = await CreateConfig( 2026 )
4
+
5
+ export const config = x.ConfigObject
6
+ export default x.ConfigArray
package/es5.js CHANGED
@@ -1,29 +1,16 @@
1
- "use strict";
1
+ import CreateConfig from "./internal/create-config.js"
2
2
 
3
- module.exports = {
3
+ const x = await CreateConfig( 5, {
4
4
 
5
- "extends": [
5
+ rules: {
6
6
 
7
- "@futagoza/core",
8
- "@futagoza/globals/es5",
9
-
10
- ],
11
-
12
- "parserOptions": {
13
-
14
- "ecmaVersion": 5,
15
- "ecmaFeatures": {
16
-
17
- "globalReturn": false,
18
-
19
- },
20
-
21
- },
22
-
23
- "rules": {
7
+ "prefer-object-has-own": "off",
24
8
 
25
9
  "strict": [ "error", "safe" ],
26
10
 
27
11
  },
28
12
 
29
- };
13
+ } )
14
+
15
+ export const config = x.ConfigObject
16
+ export default x.ConfigArray
@@ -0,0 +1,50 @@
1
+ import { defineConfig } from "eslint/config"
2
+ import CoreConfig from "@futagoza/eslint-config-core"
3
+
4
+ /**
5
+ * A helper function to build `@futagoza/eslint-config-javascript` configuration files
6
+ *
7
+ * @param {number} ecmaVersion
8
+ */
9
+ export default async function CreateConfig( ecmaVersion, config = {} ) {
10
+
11
+ // https://stackoverflow.com/a/67880017
12
+ const { default: GlobalsConfig } = await import( `@futagoza/eslint-config-globals/es${ ecmaVersion }.js` )
13
+
14
+ // build the main extends list
15
+ const extendList = [
16
+
17
+ GlobalsConfig,
18
+ CoreConfig,
19
+
20
+ ]
21
+
22
+ // if any extends were passed, join them with `extendList`
23
+ if ( Array.isArray( config.extends ) ) extendList.push( ...config.extends )
24
+
25
+ // delete (if passed) the provided extends
26
+ delete config.extends
27
+
28
+ // the JavaScript config
29
+ const ConfigObject = {
30
+
31
+ name: "@futagoza/eslint-config-javascript/es" + ecmaVersion,
32
+
33
+ extends: extendList,
34
+
35
+ languageOptions: { ecmaVersion },
36
+
37
+ ...config,
38
+
39
+ }
40
+
41
+ return {
42
+
43
+ ConfigObject,
44
+
45
+ // generate eslint config array to used as the default export
46
+ ConfigArray: defineConfig( ConfigObject ),
47
+
48
+ }
49
+
50
+ }
package/latest.js ADDED
@@ -0,0 +1,19 @@
1
+ import { defineConfig } from "eslint/config"
2
+ import coreConfig from "@futagoza/eslint-config-core"
3
+ import moduleConfig from "./module.js"
4
+
5
+ const config = {
6
+
7
+ name: "@futagoza/eslint-config-javascript/latest",
8
+
9
+ extends: [ coreConfig, moduleConfig ],
10
+
11
+ languageOptions: {
12
+
13
+ ecmaVersion: "latest",
14
+
15
+ },
16
+
17
+ }
18
+
19
+ export default defineConfig( config )
package/module.js ADDED
@@ -0,0 +1,23 @@
1
+ import { defineConfig } from "eslint/config"
2
+
3
+ const config = {
4
+
5
+ name: "@futagoza/eslint-config-javascript/module",
6
+
7
+ // language: "js/js",
8
+
9
+ languageOptions: {
10
+
11
+ sourceType: "module",
12
+
13
+ },
14
+
15
+ rules: {
16
+
17
+ "strict": [ "error", "never" ],
18
+
19
+ },
20
+
21
+ }
22
+
23
+ export default defineConfig( config )
package/package.json CHANGED
@@ -1,43 +1,42 @@
1
1
  {
2
2
  "name": "@futagoza/eslint-config-javascript",
3
- "version": "16.1.0",
3
+ "version": "17.0.0",
4
4
  "description": "Futago-za Ryuu's ESLint configurations for JavaScript",
5
5
  "keywords": [
6
6
  "eslint",
7
7
  "configuration",
8
- "javascript",
8
+ "ecmascript",
9
9
  "es5",
10
10
  "es6",
11
- "es2015",
12
11
  "es7",
12
+ "es2015",
13
13
  "es2016",
14
- "es8",
15
14
  "es2017",
16
- "es9",
17
15
  "es2018",
18
- "es10",
19
16
  "es2019",
20
- "es11",
21
17
  "es2020",
22
- "es12",
23
18
  "es2021",
24
- "esnext"
19
+ "es2022",
20
+ "es2023",
21
+ "es2024",
22
+ "es2025",
23
+ "es2026",
24
+ "esnext",
25
+ "javascript"
25
26
  ],
26
27
  "repository": "https://github.com/futagoza/eslint-config-futagozaryuu/tree/master/packages/@futagoza/eslint-config-javascript",
27
28
  "license": "MIT",
28
29
  "author": "Futago-za Ryuu",
29
- "main": "index.js",
30
+ "main": "es2023.js",
31
+ "type": "module",
30
32
  "dependencies": {
31
- "@babel/core": "7.14.3",
32
- "@babel/eslint-parser": "7.14.3",
33
- "@babel/eslint-plugin": "7.13.16",
34
- "@futagoza/eslint-config-core": "16.1.0",
35
- "@futagoza/eslint-config-globals": "16.1.0"
33
+ "@futagoza/eslint-config-core": "17.0.0",
34
+ "@futagoza/eslint-config-globals": "17.0.0"
36
35
  },
37
36
  "peerDependencies": {
38
37
  "eslint": "*"
39
38
  },
40
39
  "engines": {
41
- "node": ">=12.0.0"
40
+ "node": ">=20.0.0"
42
41
  }
43
42
  }
package/script.js ADDED
@@ -0,0 +1,33 @@
1
+ import { defineConfig } from "eslint/config"
2
+
3
+ const config = {
4
+
5
+ name: "@futagoza/eslint-config-javascript/script",
6
+
7
+ // language: "js/js",
8
+
9
+ languageOptions: {
10
+
11
+ sourceType: "script",
12
+
13
+ parserOptions: {
14
+
15
+ ecmaFeatures: {
16
+
17
+ globalReturn: false,
18
+
19
+ },
20
+
21
+ },
22
+
23
+ },
24
+
25
+ rules: {
26
+
27
+ "strict": [ "error", "function" ],
28
+
29
+ },
30
+
31
+ }
32
+
33
+ export default defineConfig( config )
package/esnext.js DELETED
@@ -1,74 +0,0 @@
1
- "use strict";
2
-
3
- const { config } = require( "@futagoza/eslint-config-core/internal" );
4
-
5
- module.exports = {
6
-
7
- "extends": "./es2021.js",
8
-
9
- "parser": "@babel/eslint-parser",
10
- "parserOptions": {
11
-
12
- "requireConfigFile": false,
13
-
14
- },
15
-
16
- "plugins": [ "@babel/eslint-plugin" ],
17
- "rules": {
18
-
19
- // `@babel/eslint-plugin` provides better support for the following rules
20
-
21
- "new-cap": "off",
22
- "no-invalid-this": "off",
23
- "no-unused-expressions": "off",
24
- "object-curly-spacing": "off",
25
- "semi": "off",
26
-
27
- /**
28
- * require constructor names to begin with a capital letter
29
- *
30
- * @see
31
- * - http://eslint.org/docs/rules/new-cap
32
- * - https://github.com/babel/babel/tree/master/eslint/babel-eslint-plugin#rules
33
- */
34
- "@babel/new-cap": config[ "new-cap" ],
35
-
36
- /**
37
- * disallow `this` keywords outside of classes or class-like objects
38
- *
39
- * @see
40
- * - http://eslint.org/docs/rules/no-invalid-this
41
- * - https://github.com/babel/babel/tree/master/eslint/babel-eslint-plugin#rules
42
- */
43
- "@babel/no-invalid-this": config[ "no-invalid-this" ],
44
-
45
- /**
46
- * disallow unused expressions
47
- *
48
- * @see
49
- * - http://eslint.org/docs/rules/no-unused-expressions
50
- * - https://github.com/babel/babel/tree/master/eslint/babel-eslint-plugin#rules
51
- */
52
- "@babel/no-unused-expressions": config[ "no-unused-expressions" ],
53
-
54
- /**
55
- * 🔧 enforce consistent spacing inside braces
56
- *
57
- * @see
58
- * - http://eslint.org/docs/rules/object-curly-spacing
59
- * - https://github.com/babel/babel/tree/master/eslint/babel-eslint-plugin#rules
60
- */
61
- "@babel/object-curly-spacing": config[ "object-curly-spacing" ],
62
-
63
- /**
64
- * 🔧 require or disallow semicolons instead of ASI
65
- *
66
- * @see
67
- * - http://eslint.org/docs/rules/semi
68
- * - https://github.com/babel/babel/tree/master/eslint/babel-eslint-plugin#rules
69
- */
70
- "@babel/semi": config[ "semi" ],
71
-
72
- },
73
-
74
- };
package/index.js DELETED
@@ -1,7 +0,0 @@
1
- "use strict";
2
-
3
- module.exports = {
4
-
5
- "extends": "./esnext.js",
6
-
7
- };
package/modules.js DELETED
@@ -1,16 +0,0 @@
1
- "use strict";
2
-
3
- module.exports = {
4
-
5
- "parserOptions": {
6
-
7
- "sourceType": "module",
8
-
9
- },
10
- "rules": {
11
-
12
- "strict": [ "error", "never" ],
13
-
14
- },
15
-
16
- };
package/strict.js DELETED
@@ -1,11 +0,0 @@
1
- "use strict";
2
-
3
- module.exports = {
4
-
5
- "rules": {
6
-
7
- "strict": [ "error", "global" ],
8
-
9
- },
10
-
11
- };