@jgarber/eslint-config 0.2.0 → 1.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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2022 Jason Garber
3
+ Copyright (c) 2022–present Jason Garber
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,3 +1,38 @@
1
1
  # eslint-config
2
2
 
3
- Shareable [ESLint](https://eslint.org) configurations.
3
+ Shareable [ESLint](https://eslint.org) configuration.
4
+
5
+ > **Note**
6
+ > As of v1.0.0, this shareable configuration uses ESLint's new "flat" configuration file format and, thus, may not be suitable for every project. See [the official documentation](https://eslint.org/docs/latest/use/configure/configuration-files-new) for details.
7
+
8
+ ## Installation
9
+
10
+ ```sh
11
+ npm install --save-dev @jgarber/eslint-config
12
+ ```
13
+
14
+ ## Usage
15
+
16
+ Using [CommonJS module](https://nodejs.org/api/modules.html) syntax:
17
+
18
+ ```js
19
+ // eslint.config.js
20
+ module.exports = require('@jgarber/eslint-config');
21
+ ```
22
+
23
+ Using [ECMAScript module (ESM)](https://nodejs.org/api/esm.html) syntax:
24
+
25
+ ```js
26
+ // eslint.config.js
27
+ import config from '@jgarber/eslint-config';
28
+
29
+ export default [
30
+ ...config,
31
+ {
32
+ files: ['**/*.js'],
33
+ languageOptions: {
34
+ sourceType: 'module'
35
+ }
36
+ }
37
+ ];
38
+ ```
@@ -0,0 +1,32 @@
1
+ /*
2
+ * Import Standard's ESLint configurtation for use with ESLint's new "flat"
3
+ * configuration file format.
4
+ *
5
+ * @see {@link https://github.com/standard/eslint-config-standard/blob/master/.eslintrc.json}
6
+ * @see {@link https://eslint.org/docs/latest/use/configure/configuration-files-new}
7
+ */
8
+ const standard = require('eslint-config-standard');
9
+
10
+ module.exports = [
11
+ {
12
+ plugins: Object.fromEntries(standard.plugins.map(plugin => [plugin, require(`eslint-plugin-${plugin}`)])),
13
+ rules: {
14
+ ...standard.rules,
15
+
16
+ // Enforces consistent use of semicolons.
17
+ semi: ['error', 'always']
18
+ }
19
+ },
20
+ {
21
+ /*
22
+ * By default, ESLint's "flat" config considers `*.js` files as ECMAScript
23
+ * modules (ESM). Instead, consider `*.js` files to be CommonJS modules.
24
+ *
25
+ * @see {@link https://eslint.org/docs/latest/use/configure/configuration-files-new#configuration-objects}
26
+ */
27
+ files: ['**/*.js'],
28
+ languageOptions: {
29
+ sourceType: 'commonjs'
30
+ }
31
+ }
32
+ ];
package/index.js CHANGED
@@ -1,22 +1 @@
1
- module.exports = {
2
- extends: 'eslint:recommended',
3
-
4
- rules: {
5
- // Enforces consistent use of trailing commas in object and array literals.
6
- 'comma-dangle': ['error', 'never'],
7
-
8
- // Enforces a consistent indentation style.
9
- 'indent': ['error', 2],
10
-
11
- // Enforces consistent line endings independent of operating system, VCS,
12
- // or editor used across your codebase.
13
- 'linebreak-style': ['error', 'unix'],
14
-
15
- // Enforces the consistent use of either backticks, double, or single
16
- // quotes.
17
- 'quotes': ['error', 'single'],
18
-
19
- // Enforces consistent use of semicolons.
20
- 'semi': ['error', 'always']
21
- }
22
- };
1
+ module.exports = require('./eslint.config.js');
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@jgarber/eslint-config",
3
- "version": "0.2.0",
4
- "description": "Shareable ESLint configurations.",
3
+ "version": "1.0.0",
4
+ "description": "Shareable ESLint configuration.",
5
5
  "keywords": [
6
6
  "eslint",
7
7
  "eslintconfig",
@@ -13,8 +13,7 @@
13
13
  "license": "MIT",
14
14
  "author": "Jason Garber <jason@sixtwothree.org> (https://sixtwothree.org)",
15
15
  "files": [
16
- "eleventy.js",
17
- "module.js"
16
+ "eslint.config.js"
18
17
  ],
19
18
  "main": "index.js",
20
19
  "repository": "github:jgarber623/eslint-config",
@@ -24,8 +23,13 @@
24
23
  "engines": {
25
24
  "node": ">=16.0.0"
26
25
  },
26
+ "devDependencies": {
27
+ "eslint": "^8.43.0",
28
+ "eslint-config-standard": "^17.1.0"
29
+ },
27
30
  "peerDependencies": {
28
- "eslint": "^8.12.0"
31
+ "eslint": ">=8.43.0",
32
+ "eslint-config-standard": ">=17.1.0"
29
33
  },
30
34
  "publishConfig": {
31
35
  "access": "public"
package/eleventy.js DELETED
@@ -1,16 +0,0 @@
1
- module.exports = {
2
- extends: './index',
3
-
4
- env: {
5
- node: true
6
- },
7
-
8
- parserOptions: {
9
- ecmaVersion: 2017
10
- },
11
-
12
- ignorePatterns: [
13
- '!.eleventy.js',
14
- 'public/'
15
- ]
16
- };
package/module.js DELETED
@@ -1,17 +0,0 @@
1
- module.exports = {
2
- extends: './index',
3
-
4
- env: {
5
- browser: true,
6
- es6: true
7
- },
8
-
9
- parserOptions: {
10
- sourceType: 'module'
11
- },
12
-
13
- ignorePatterns: [
14
- 'dist/*',
15
- 'spec/*'
16
- ]
17
- };