eslint-config-tungsten-js-flat 0.2.0 → 0.3.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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,YAAY,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAC1D,YAAY,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;;AAEpC,wBAoJE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA,YAAY,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAC1D,YAAY,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;;AAEpC,wBAkJE"}
package/dist/index.js CHANGED
@@ -1,6 +1,8 @@
1
1
  import globals from 'globals';
2
2
  import pluginJs from '@eslint/js';
3
3
  import pluginReact from 'eslint-plugin-react';
4
+ import stylistic from '@stylistic/eslint-plugin';
5
+ import pluginImportX from 'eslint-plugin-import-x';
4
6
  import { defineConfig } from 'eslint/config';
5
7
  export default defineConfig([
6
8
  { files: ["**/*.{js,mjs,cjs,jsx,ts,mts,cts,tsx}"] },
@@ -16,6 +18,10 @@ export default defineConfig([
16
18
  pluginJs.configs.recommended,
17
19
  pluginReact.configs.flat.recommended, // dumb funkers typed their flat config repository as Record<string, ReactFlatConfig>
18
20
  {
21
+ "plugins": {
22
+ "@stylistic": stylistic,
23
+ "import-x": pluginImportX,
24
+ },
19
25
  "rules": {
20
26
  //// errors or likely errors
21
27
  "no-undef": ["error", { "typeof": true }],
@@ -43,7 +49,7 @@ export default defineConfig([
43
49
  },
44
50
  // add extra objects here, they are not stored within an array. weird.
45
51
  ],
46
- "import/extensions": ["error", "always"],
52
+ "import-x/extensions": ["error", "always"],
47
53
  //// safety
48
54
  //"import/no-default-export": "warn", // too restrictive, disabled
49
55
  "no-case-declarations": "warn", // warn about declaring variables in switch blocks due to scoping issues
@@ -56,7 +62,7 @@ export default defineConfig([
56
62
  "no-unreachable": "warn",
57
63
  //"no-return-await": "warn",
58
64
  "no-unused-vars": ["warn", {
59
- "argsIgnorePattern": "^(?:_|req|request|res|response|next|resolve|reject|resolve|reject)$",
65
+ "argsIgnorePattern": "^(?:_|req|request|res|response|next|resolve|reject)$",
60
66
  "ignoreRestSiblings": true
61
67
  }],
62
68
  "no-constant-condition": "warn", // enabled by eslint:recommended. Not sure whether to keep
@@ -65,35 +71,35 @@ export default defineConfig([
65
71
  "prefer-const": "warn",
66
72
  "no-useless-escape": "warn", // will turn to off eventually // came from eslint:recommended
67
73
  //// style
68
- "semi": ["warn", "never"], // semi-colons
69
- "indent": ["warn", 4, {
74
+ "@stylistic/semi": ["warn", "never"], // semi-colons
75
+ "@stylistic/indent": ["warn", 4, {
70
76
  "SwitchCase": 1, // indent switch contents by 1 indent
71
77
  "MemberExpression": "off", // .then .catch etc chained methods - off to allow dev style?
72
78
  "ignoreComments": true
73
79
  }],
74
- //"no-mixed-spaces-and-tabs": "warn",
75
- "no-trailing-spaces": ["warn", {
80
+ //"@stylistic/no-mixed-spaces-and-tabs": "warn",
81
+ "@stylistic/no-trailing-spaces": ["warn", {
76
82
  "skipBlankLines": true,
77
83
  "ignoreComments": true
78
84
  }],
79
- "quotes": ["warn", "single"],
85
+ "@stylistic/quotes": ["warn", "single"],
80
86
  //// minor style
81
- "keyword-spacing": ["warn", {
87
+ "@stylistic/keyword-spacing": ["warn", {
82
88
  "overrides": {
83
89
  "catch": { "after": true } // after catch
84
90
  }
85
91
  }],
86
92
  "object-shorthand": ["warn", "properties"], // use { prop } instead of { prop : prop }. But don't require { a() } instead of { a: function() }
87
- "max-len": ["warn", 120, {
93
+ "@stylistic/max-len": ["warn", 120, {
88
94
  "ignoreComments": true,
89
95
  //"ignoreStrings": true, // too eager
90
96
  }], // maximum 120 chars per line
91
- "brace-style": ["warn", "1tbs", { "allowSingleLine": true }], // { } rules
97
+ "@stylistic/brace-style": ["warn", "1tbs", { "allowSingleLine": true }], // { } rules
92
98
  "camelcase": ["warn", {
93
99
  "allow": ["^(db|DB|mongo|MONGO|mysql|MYSQL|postgres?|POSTGRES?)_"],
94
100
  "ignoreGlobals": true
95
101
  }], // camelCase variables
96
- "eol-last": ["warn", "always"],
102
+ "@stylistic/eol-last": ["warn", "always"],
97
103
  // disabling/softening default eslint rules rules
98
104
  "no-inner-declarations": "warn",
99
105
  "no-async-promise-executor": "warn",
@@ -124,18 +130,12 @@ export default defineConfig([
124
130
  }
125
131
  },
126
132
  {
127
- "settings": {
128
- "react": {
129
- "version": "detect",
130
- "defaultVersion": "18",
131
- },
132
- }
133
- },
134
- {
133
+ // Pinned, not 'detect': tungsten uses eslint-plugin-react for JSX linting without
134
+ // React installed, so detection warns on every run - and on eslint 10 it throws
135
+ // (contextOrFilename.getFilename is not a function in the plugin's version.js).
135
136
  settings: {
136
137
  react: {
137
- version: 'detect',
138
- defaultVersion: '18.3.1',
138
+ version: '18.3.1',
139
139
  },
140
140
  }
141
141
  }
package/package.json CHANGED
@@ -1,21 +1,24 @@
1
1
  {
2
2
  "name": "eslint-config-tungsten-js-flat",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "",
5
5
  "type": "module",
6
+ "files": [
7
+ "dist"
8
+ ],
6
9
  "main": "dist/index.js",
7
10
  "keywords": [],
8
11
  "author": "",
9
12
  "license": "UNLICENSED",
10
13
  "dependencies": {
11
- "@eslint/js": "^9.39.4",
12
- "@types/eslint": "^9.6.1",
13
- "@types/eslint__js": "^8.42.3",
14
+ "@eslint/js": "^10.0.1",
15
+ "@stylistic/eslint-plugin": "^5.10.0",
16
+ "eslint-plugin-import-x": "^4.17.1",
14
17
  "eslint-plugin-react": "^7.37.5",
15
18
  "globals": "^15.15.0"
16
19
  },
17
20
  "peerDependencies": {
18
- "eslint": "^9.39.4"
21
+ "eslint": "^9.0.0 || ^10.0.0"
19
22
  },
20
23
  "__OldPeerDependencies": {
21
24
  "@babel/core": "^7.16.0",
@@ -29,7 +32,6 @@
29
32
  "typescript": "^5.9.3"
30
33
  },
31
34
  "scripts": {
32
- "build": "tsc --watch",
33
- "prepublish": "tsc"
35
+ "build": "tsc --watch"
34
36
  }
35
37
  }
@@ -1,11 +0,0 @@
1
- // declare module 'eslint-plugin-react' {
2
- // export const configs: {
3
- // flat: {
4
- // recommended: {
5
- // plugins: { react: unknown },
6
- // rules: unknown,
7
- // languageOption: unknown
8
- // }
9
- // }
10
- // }
11
- // }
package/src/index.ts DELETED
@@ -1,157 +0,0 @@
1
-
2
- import globals from 'globals'
3
- import pluginJs from '@eslint/js'
4
- import pluginReact from 'eslint-plugin-react'
5
- import { defineConfig } from 'eslint/config'
6
- export type { ReactFlatConfig } from 'eslint-plugin-react' // needed to solve TS portable error on pluginReact.configs.flat.recommended
7
- export type { Linter } from 'eslint' // needed to solve TS portable error (on pluginJs.configs.recommended ?)
8
-
9
- export default defineConfig([
10
- { files: ["**/*.{js,mjs,cjs,jsx,ts,mts,cts,tsx}"] },
11
- { languageOptions: {
12
- globals: {
13
- ...globals.browser,
14
- ...globals.node,
15
- Sass: true,
16
- Scss: true,
17
- Css: true
18
- }
19
- } },
20
- pluginJs.configs.recommended,
21
- pluginReact.configs.flat.recommended !, // dumb funkers typed their flat config repository as Record<string, ReactFlatConfig>
22
- {
23
- "rules" : {
24
-
25
- //// errors or likely errors
26
- "no-undef": ["error", { "typeof": true }],
27
- "no-import-assign": "error",
28
- "no-unexpected-multiline": "error",
29
- "no-fallthrough": "error",
30
- "no-unsafe-negation": "error",
31
- "no-restricted-globals": [
32
- "error",
33
- {
34
- "name": "__dirname",
35
- "message": "__dirname does not exist in ES6 modules. Extract dirname from import.meta.url."
36
- },
37
- {
38
- "name": "require",
39
- "message": "require does not exist in ES6 modules. Use import { createRequire } from 'module'; const require = createRequire(import.meta.url) if you need require."
40
- },
41
- {
42
- "name": "module",
43
- "message": "module does not exist in ES6 modules. Use export if trying to export from ES6 modules."
44
- },
45
- {
46
- "name": "exports",
47
- "message": "exports does not exist in ES6 modules. Use export to export from ES6 modules."
48
- },
49
- // add extra objects here, they are not stored within an array. weird.
50
- ],
51
- "import/extensions": ["error", "always"],
52
-
53
- //// safety
54
- //"import/no-default-export": "warn", // too restrictive, disabled
55
- "no-case-declarations" : "warn", // warn about declaring variables in switch blocks due to scoping issues
56
- "no-cond-assign": "warn", // assigning to a variable with = instead an if or other check. Allowed but warned
57
- "eqeqeq": "warn", // suggest === instead of ==
58
-
59
- //// maintenance
60
- "no-console": "warn", // suggest not using console.log, instead using custom functions
61
- // allowing debug and output to be intercepted later
62
-
63
- //// inefficiencies
64
- "no-unreachable": "warn",
65
- //"no-return-await": "warn",
66
- "no-unused-vars": ["warn", {
67
- "argsIgnorePattern": "^(?:_|req|request|res|response|next|resolve|reject|resolve|reject)$",
68
- "ignoreRestSiblings": true
69
- } ],
70
- "no-constant-condition": "warn", // enabled by eslint:recommended. Not sure whether to keep
71
- "no-self-assign": "warn",
72
-
73
- //// information
74
- "prefer-const": "warn",
75
- "no-useless-escape": "warn", // will turn to off eventually // came from eslint:recommended
76
-
77
- //// style
78
- "semi": ["warn", "never"], // semi-colons
79
- "indent": ["warn", 4, {
80
- "SwitchCase": 1, // indent switch contents by 1 indent
81
- "MemberExpression" : "off", // .then .catch etc chained methods - off to allow dev style?
82
- "ignoreComments" : true
83
- }],
84
- //"no-mixed-spaces-and-tabs": "warn",
85
- "no-trailing-spaces" : ["warn", {
86
- "skipBlankLines": true,
87
- "ignoreComments": true
88
- }],
89
- "quotes": ["warn", "single"],
90
-
91
- //// minor style
92
- "keyword-spacing": ["warn", {
93
- "overrides": { // space after keywords like if
94
- "catch": { "after": true } // after catch
95
- }
96
- }],
97
- "object-shorthand": ["warn", "properties"], // use { prop } instead of { prop : prop }. But don't require { a() } instead of { a: function() }
98
- "max-len" : ["warn", 120, {
99
- "ignoreComments": true,
100
- //"ignoreStrings": true, // too eager
101
- } ], // maximum 120 chars per line
102
- "brace-style": ["warn", "1tbs", { "allowSingleLine": true }], // { } rules
103
- "camelcase": ["warn", {
104
- "allow": ["^(db|DB|mongo|MONGO|mysql|MYSQL|postgres?|POSTGRES?)_"],
105
- "ignoreGlobals": true
106
- }], // camelCase variables
107
- "eol-last": ["warn", "always"],
108
-
109
- // disabling/softening default eslint rules rules
110
- "no-inner-declarations": "warn",
111
- "no-async-promise-executor": "warn",
112
- "no-useless-catch": "warn",
113
- "no-func-assign": "off",
114
- "no-empty": "off",
115
-
116
- // replace ban-types -- not supported in this version of eslint
117
- // "ban-types": "off",
118
- // "no-empty-object-type": "off",
119
- // "no-unsafe-function-type": "warn",
120
- // "no-wrapper-object-types": "warn",
121
-
122
- // former active rules
123
- "consistent-return": "off",
124
- "require-await": "off", // warn if async funcs don't have an await
125
-
126
- //// React rules
127
- 'react/react-in-jsx-scope': 'off', // don't require React to be defined ...
128
- "react/prop-types": "off",
129
- "react/self-closing-comp": "warn",
130
- "react/no-direct-mutation-state": "off", // we mutate state now
131
- "react/no-unknown-property": ["warn", { ignore: ['bind' ,'filter', 'css'] }],
132
- "react/no-unescaped-entities": "off", // I think we handle HTML entities already
133
- },
134
- },
135
- {
136
- "files": ["**/*.cjs"],
137
- "rules": {
138
- "no-restricted-globals": ["error", ""]
139
- }
140
- },
141
- {
142
- "settings": {
143
- "react": {
144
- "version": "detect",
145
- "defaultVersion": "18",
146
- },
147
- }
148
- },
149
- {
150
- settings: {
151
- react: {
152
- version: 'detect',
153
- defaultVersion: '18.3.1',
154
- },
155
- }
156
- }
157
- ])
package/tsconfig.json DELETED
@@ -1,104 +0,0 @@
1
- {
2
- "include": ["src"],
3
- "compilerOptions": {
4
- /* Visit https://aka.ms/tsconfig to read more about this file */
5
-
6
- /* Projects */
7
- // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
8
- // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
9
- // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
10
- // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
11
- // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
12
- // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
13
-
14
- /* Language and Environment */
15
- "target": "es2022", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
16
- // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
17
- "jsx": "preserve", /* Specify what JSX code is generated. */
18
- // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
19
- // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
20
- // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
21
- // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
22
- // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
23
- // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
24
- // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
25
- "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
26
- // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
27
-
28
- /* Modules */
29
- "module": "Node16", /* Specify what module code is generated. */
30
- "rootDir": "./src", /* Specify the root folder within your source files. */
31
- // "moduleResolution": "NodeNext", /* Specify how TypeScript looks up a file from a given module specifier. */
32
- // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
33
- // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
34
- // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
35
- // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
36
- // "types": [], /* Specify type package names to be included without being referenced in a source file. */
37
- // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
38
- // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
39
- "resolveJsonModule": true, /* Enable importing .json files. */
40
- // "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
41
-
42
- /* JavaScript Support */
43
- // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
44
- // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
45
- // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
46
-
47
- /* Emit */
48
- "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
49
- "declarationMap": true, /* Create sourcemaps for d.ts files. */
50
- // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
51
- // "sourceMap": true, /* Create source map files for emitted JavaScript files. */
52
- // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
53
- "outDir": "./dist", /* Specify an output folder for all emitted files. */
54
- // "removeComments": true, /* Disable emitting comments. */
55
- // "noEmit": true, /* Disable emitting files from a compilation. */
56
- // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
57
- // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
58
- // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
59
- // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
60
- // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
61
- // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
62
- // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
63
- // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
64
- // "newLine": "crlf", /* Set the newline character for emitting files. */
65
- // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
66
- // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
67
- // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
68
- // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
69
- // "declarationDir": "./", /* Specify the output directory for generated declaration files. */
70
- // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
71
-
72
- /* Interop Constraints */
73
- // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
74
- // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
75
- "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
76
- // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
77
- "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
78
-
79
- /* Type Checking */
80
- "strict": true, /* Enable all strict type-checking options. */
81
- // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
82
- // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
83
- // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
84
- // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
85
- // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
86
- // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
87
- // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
88
- // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
89
- // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
90
- // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
91
- "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
92
- // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
93
- // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
94
- "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
95
- // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
96
- // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
97
- // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
98
- // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
99
-
100
- /* Completeness */
101
- // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
102
- "skipLibCheck": false /* Skip type checking all .d.ts files. */
103
- }
104
- }